Skip to main content

dbt Power User (VS Code Extension)

dbt Power User is a VS Code Extension to make VS Code work seamlessly with dbt.

The Extension has many features, including a sqlfmt-powered formatter.

tip

sqlfmt must be available on the PATH in order to be accessed by dbt Power User. Install sqlfmt with pipx to isolate its dependencies and add it to the PATH.

After installing sqlfmt and the dbt Power User extension:

  1. Associate your .sql files with the jinja-sql language. Select Preferences > Settings, and under Files: Associations click Add Item: Screenshot of VS Code Settings menu, with Add Items button highlighted

    Alternatively, add the following to your VS Code settings.json:

    settings.json
    "files.associations": {
    "*.sql": "jinja-sql"
    },
  2. Select "dbt Power User" (extension id:innoverio.vscode-dbt-power-user) as the default formatter. You can do this either by using the context menu (right click on an open dbt model in the editor) and select "Format Document With...", or you can add the following to your VS Code settings:

    settings.json
    "[jinja-sql]": {
    "editor.defaultFormatter": "innoverio.vscode-dbt-power-user"
    }
  3. You can enable format on save by adding another line to your VS Code settings:

    settings.json
    "[jinja-sql]": {
    "editor.defaultFormatter": "innoverio.vscode-dbt-power-user",
    "editor.formatOnSave": true
    }