DBT project in sub-folder
Hi,
First of all, thank you for creating this amazing extension. I have discovered a potential bug, or perhaps at least something that could be documented better.
My folder structure looks like this:
vscode_workspace_folder
├── dax_code
├── dbt_model
│ ├── analysis
│ ├── data
│ ├── dbt_modules
│ ├── logs
│ ├── macros
│ ├── models
│ ├── snapshots
│ ├── target
├── erd_diagrams
├── sql_functions
└── tmp
I am opening vscode_workspace_folder as my workspace folder in vscode, but my DBT folder is in a sub-folder. This causes sqlfluff to not work on sql files that contain custom macros.
There is no error or logging anywhere, it just doesn't work.
Through trial and error I have narrowed it down to jinja-SQL files that are using custom macros.
And when I open the DBT folder directly, then everything works. It picks up my sqlfuff file and uses the DBT templater to do the linting as expected.
Greetings, kim
Hi @infused-kim 👋 , welcome to the project
Thank you for raising the issue, this is a known missing feature: https://github.com/sqlfluff/sqlfluff/issues/601
It is also mentioned in the docs here: https://docs.sqlfluff.com/en/stable/configuration.html?highlight=dbt%20templater#known-caveats
Thank you for bringing up this issue. I'm having the same problem. I've exactly same dbt project structure dbt project is a subdirectory in my workspaceFolder. I've configured templater = dbt inside .sqlfluff and files to ignore inside .sqlfluffignore in the workspaceFolder. When I execute sqlfluff from the workspaceFolder directory, no lining violation are found. But, when I execute sqlfluff from my dbt project subdirectory, it works properly and fixes the file using the .sqlfluff configurations.
Same issue with sqlfluff pre-commit hooks. When I run pre-commit hook, no lingting violations are found, which is not right.