Open reegs opened 2 years ago
Yeah, I'm not sure that the dbt templater will work at all for this extension either. Does the formatting also not work? And if formatting does not work, could you try setting sqlfluff.experimental.format.executeInTerminal = true
and attempt to format the document again? This setting still has some known bugs, but it runs the sqlfluff command directly on the file instead of passing the text through stdin
, which from the other issue sounds like the source of the problem.
Thanks for the reply Robert, for the moment the formatting of the document also doesn't work via the extension even when I set sqlfluff.experimental.format.executeInTerminal = true
as you suggested. VS Code will give me a progress bar moving across the top of the editor window, which to me indicates that it's doing something, but it doesn't format the document or provide linting problems.
Yeah, that doesn't surprise me, but I had hoped maybe that setting would work. I should have some free time in the next week or two to figure out if I can get the extension to work with the dbt templater.
@reegs Do you get the correct linting problems when you run the sqlfluff lint {path}
command from the command line? And what happens when you run sqlfluff fix {path}
from the command line?
Could you also attempt the latest version, currently v0.2.7, and let me know if the linting works for you in that version.
One other thing to note, the linting currently only works when the setting sqlfluff.linter.run
is set to onSave
I first also thought there was a problem with vscode-sqlfluff-extended
.
With this config
[sqlfluff]
templater = dbt
I get "SQLFluff Formatting Failed." But when I ran sqlfluff lint {path}
and sqlfluff fix {path}
, I noticed that the problem was due to dbt, not vscode-sqlfluff-extended.
I think ultimately sqlfluff in combination with dbt is prone to fail. The entire complex linting, including dbt references / model dependencies / etc. belongs into a CI/CD pipeline. It would be great if there was an easy to use auto-formatter plugin for vscode (like black code style plugins for python), but sqlfluff might not be able to deliver that (if the code contains dbt specific syntax).
Hi, I've been running into a similar issue as this issue on the other vscode-sqlfluff repository. When I set
inside of my .sqlfluff file I am unable to get the extension to properly lint my files, but when I either leave templater argument blank or set it to Jinja the extension functions properly. I'm running sqlfluff v. 1.1.0 and sqlfluff-templater-dbt v. 1.1.0 on MacOS. Happy to provide any other information that may be of use.