I'm using VS Code on macOS. I installed sqlfluff locally using pip. I also installed it via the extensions UI.
I am trying to format my code manually via the UI. When I select my code, do a left click and then opt for options like "SQLFluff Format Selection" or "Format Selection -> sqlfluff", I get this error:
Command failed to execute, check logs for details
The sqlfluff executable was not found. Use the 'Executable Path' setting to configure the location of the executable, or add it to your PATH.
I could make it work via the terminal with
sqlfluff fix filepath
but the issue is that I use some variables within my dbt sql code.
While running sqlfluff, I would get this error now
Skipped file xxx.sql because dbt raised a fatal exception during compilation: Compilation Error in model xxx (xxx.sql)
Required var 'backfill_date_start' not found in config:
Vars supplied to xxx = {}
WARNING Tried to denylist unknown rules references: ['AL09']
Normally, when running the dbt models, I run them like this:
dbt run --select xxx --vars '{backfill_date_start: "2025-07-17", backfill_date_end: "2025-07-20"}'
Due to other dependencies, I can't change how variables are handled at the moment. Is there any way to make sqlfluff work meanwhile?