Setting up an IDE to understand jinja commands and macros

I have not found relevant information regarding making an IDE (vscode, datagrip) work with the jinja templates to allow me to import and use macros (or even {% set … %}) in an sql file.

i did see the post here and i did set
“files.associations”: {
“*.sql”:“jinja-sql”,
/target/”:“”
}
in the config.json to vscode

but when running the file
the error is on the first instance of ‘{’
TIA

Hi @vish!

Bastien’s done some good work on getting dbt autocomplete snippets and linters to work well with Jinja. You can find his package in his vscode-dbt repo!

It is still in development stage and we’re working to hopefully release it in the vscode marketplace but for now you can use his package and it works great!

Quick note: it requires you install better-jinja, then you can manually add the package which Bastien put together.

Once both are installed you should be good to go!

1 Like