sqlfluff / vscode-sqlfluff

An extension to use the sqlfluff linter in vscode.
https://marketplace.visualstudio.com/items?itemName=dorzey.vscode-sqlfluff
MIT License
156 stars 33 forks source link

[Templater: dbt] User Error: The dbt templater does not support stdin input, provide a path instead #153

Closed moseleyi closed 1 month ago

moseleyi commented 3 months ago

image

I'm getting this error every time I open a sql file in dbt project. Not sure what to do?

JunkMyFunk commented 3 months ago

Same issue, output from SQLFluff is:

------------------------------------------------------------

Format triggered for /etl/dbt/ssmp/models/looker_explores/explore_product_availability_score.sql

------------------------------------------------------------

Reading from stdin, not file, input may be dirty/partial

--------------------Executing Command--------------------

/etl/dbt/ssmp/.venv/bin/sqlfluff fix --stdin-filename dbt/ssmp/models/looker_explores/explore_product_availability_score.sql -

------------------------------------------------------------

Received close event, code 2 signal null
Raw stdout output:

------------------------------------------------------------

------------------------------------------------------------

Raw stderr output:

------------------------------------------------------------

User Error: The dbt templater does not support stdin input, provide a path instead

------------------------------------------------------------
RobertOstermann commented 3 months ago

Do you have the extension configured for DBT?

  "sqlfluff.linter.run": "onSave",
  "sqlfluff.experimental.format.executeInTerminal": true,
  "editor.formatOnSave": false,
moseleyi commented 3 months ago

Surprisingly now no file is detected properly: image It's weird since obviously it's a file I opened and its path is correct: image

JunkMyFunk commented 3 months ago

I was missing "sqlfluff.experimental.format.executeInTerminal": true, adding this resolved the issue.