Install the dbt VS Code extension Preview
The dbt extension for VS Code and Cursor, powered by the dbt Fusion Engine, streamlines dbt development workflows.
Prerequisites
To use the extension, you must meet the following prerequisites:
| Prerequisite | Details |
|---|---|
| dbt Fusion Engine | The dbt VS Code extension requires the dbt Fusion Engine binary (a small executable program). Installing the extension prompts for installation of the dbt Fusion Engine. You can also manually install it at any time. |
| Registration — After installation, use the extension for 14 days, then register your email or log in with your existing dbt platform account to continue using it. ⁃ Don't have a dbt account? Follow the VS Code “get started” flow to register and verify your email. ⁃ Returning user? If you have an existing dbt platform (whether expired or active), no need to register! Just log in with the same email to prevent duplicate accounts. If you cannot log into the account associated with your email or if it's locked, reach out to dbt Support to have it unlocked or reset before logging in. | |
| Project files | Your dbt project needs a profiles.yml configuration file.⁃ dbt platform users need to have a dbt_cloud.yml file as well as a profiles.yml file configured in their dbt project.⁃ Note that having a dbt platform user account isn't the same as having a dbt platform project — you don't need a dbt platform project to use the extension. |
| Editor | VS Code or Cursor code editor. |
| Operating systems | macOS, Windows, or Linux-based computer. |
Installation instructions
This is the only official dbt Labs VS Code extension. Other extensions can work alongside the dbt VS Code extension, but they aren’t tested or supported by dbt Labs.
Read the Fusion Diaries for the latest updates.
In VS Code:
- Navigate to the Extensions tab of your editor and search for
dbt. Locate the extension from the publisherdbtLabsIncordbt Labs Inc. Click Install. - Open a dbt project in your VS Code environment if you haven't already. Make sure it is added to your current workspace. If you see a dbt Extension label in your editor's status bar, then the extension has installed successfully. You can hover over this dbt Extension label to see diagnostic information about the extension.
- Once the dbt extension is activated, it will automatically begin downloading the correct dbt Language Server for your operating system.
- If the dbt Fusion engine is not already installed on your machine, the extension will prompt you to download and install it. Follow the steps shown in the notification to complete the installation.
- Run the VS Code extension upgrade tool to ensure your dbt project is Fusion ready and help you fix any errors and deprecations.
- You're all set up! See about the dbt extension for more information on how to use the dbt extension.
Getting started
Once the dbt VS Code extension has been installed in your environment, the dbt logo will appear on the sidebar. From here, you can access workflows to help you get started, offers information about the extension and your dbt project, and provides helpful links to guide you. For more information, see the the dbt extension menu documentation.
To get started with the extension:
- From the sidebar menu, click the dbt logo to open the menu and expand the Get started section.
- Click the dbt Walkthrough status bar to view the welcome screen.
- Click through the items to get started with the extension:
- Open your dbt project: Launches file explorer so you can select the dbt project you want to open with Fusion.
- Check Fusion compatibility: Runs the Fusion upgrade workflows to bring your project up-to-date.
- Explore features: Opens the documentation so you can learn more about all the extension has to offer.
- Register: Launches the registration workflow so you can continue to use the extension beyond the trial period.
Upgrade to Fusion
If you are already running the dbt Fusion Engine, you must be on version 2.0.0-beta.66 or higher to use the upgrade tool.
The dbt extension provides a built-in upgrade tool to walk you through the process of configuring Fusion and updating your dbt project to support all of its features and fix any deprecated code. To start the process:
-
From the VS Code sidebar menu, click the dbt logo.
-
In the resulting pane, open the Get started section and click the Get started button.
You can also manually start this process by opening a CLI window and running:
dbt init --fusion-upgrade
This will start the upgrade tool and guide you through the Fusion upgrade with a series of prompts:
-
Do you have an existing dbt platform account?: If you answer
Y, you will be given instructions for downloading your dbt platform profile to register the extension. AnNanswer will skip to the next step. -
Ready to run a dbtf init? (If there is no
profiles.ymlfile present): You will go through the dbt configuration processes, including connecting to your data warehouse. -
Ready to run a dbtf debug? (If there is an existing
profiles.ymlfile): Validates that your project is configured correctly and can connect to your data warehouse. -
Ready to run a dbtf parse?: Your dbt project will be parsed to check for compatibility with Fusion.
- If any issues are encountered during the parsing, you'll be given the option to run the dbt-autofix tool to resolve the errors. If you opt to not run the tool during the upgrade processes, you can always run it later or manually fix any errors. However, the upgrade tool cannot continue until the errors are resolved.
AI Agents
There are cases where dbt-autofix may not resolve all errors and requires manual intervention. For those cases, the dbt-autofix tool provides an AI Agents.md file to enable AI agents to help with migration work after dbt-autofix has completed its part.
- If any issues are encountered during the parsing, you'll be given the option to run the dbt-autofix tool to resolve the errors. If you opt to not run the tool during the upgrade processes, you can always run it later or manually fix any errors. However, the upgrade tool cannot continue until the errors are resolved.
-
Ready to run a ‘dbtf compile -static-analysis off’? (Only runs once the parse passes): Compiles your project without any static analysis, mimicking dbt Core. This compile only renders Jinja into SQL, so Fusion's advanced SQL comprehension is temporarily disabled.
-
Ready to run a ‘dbtf compile’?: Compiles your project with full Fusion static analysis. It checks that your SQL code is valid in the context of your warehouse's tables and columns.
Once the upgrade is completed, you're ready to dive into all the features that the dbt Fusion Engine has to offer!
Register the extension
Users must complete registration within 14 days of installing the dbt extension. There are two ways to register:
- Users without an existing dbt account can register quickly and easily through an online registration form. For the initial installation, you only need to provide your name and email address to complete the registration. Subsequent installations will require you to complete the entire dbt account registration process to use the extension.
- Users with an existing dbt account can connect their account using a
dbt_cloud.ymlcredentials file.
The VS Code extension is free for organizations for up to 15 users.
New user registration
If you do not already have a dbt account, you'll need to get registered. This only takes a minute!
- Click the registration prompt in your editor.
- Accept any prompts to open the link in your browser.
- Fill out the registration form, then click Continue.
- You will receive an email with a verification link. Once you click it, your registration is complete!
Accessing your dbt account
Registering to use the dbt extension makes it easy to create a full dbt account. You can follow these steps to finish setting up your account (Note: This is not required to use the dbt extension).
- Navigate to us1.dbt.com and click Forgot password?.
- Enter the email address you used for your dbt extension registration and click Continue.
- Check your email for a verification link and follow the password reset instructions to set a password for your account.
Now that you have activated your dbt developer account, you can access features of the dbt platform. You can also re-download your registration key using the steps outlined in Register with an existing dbt account if you need to set up the dbt extension on a new machine.
Register with an existing dbt account
If you already have a dbt account, you do not need to re-register to use the dbt extension. The dbt extension can authenticate with the dbt platform using a dbt_cloud.yml file. If this file is present in your ~/.dbt/ folder, then the registration flow will automatically attempt to use this
file during registration. If you do not have a ~/.dbt/dbt_cloud.yml file downloaded, refer to the following instructions:
Configure environment variables
You need to configure environment variables (for example, DBT_ENV_VAR1) in order to use the extension's features. You can configure environment variables in a couple of different ways (for example, user-level or workspace-level).
Before you begin
If you're a dbt platform user, you might already have environment variables configured in your project or deployment environment.
- Check if you have any environment variables set in the dbt platform.
- If you need access to secret variables/values, contact you organization's dbt account admin for access.
dbt Core users can define environment variables locally in their project.
This set up will explain how to configure environment variables at the user-level. Use the following table to see which works best for you:
Where to configure | Info | Stays active | Best for |
|---|---|---|---|
| OS / shell (recommended) | Configure at the OS / shell level. Affects all terminals and the dbt extension (after VS Code reload) | Yes (across sessions) | Using both extension buttons and terminal commands |
| dbt VS Code extension settings | Configure directly in the User Settings interface or in the JSON file. Affects the dbt LSP, compile-on-save, extension menus/buttons | Yes (per VS Code settings) | Editor-only workflows |
| Terminal session | Configure in the terminal session using the export command.Affects the current terminal window only. | No (per session) | Quick, temporary testing |
If you use both the dbt extension’s buttons/menus and the terminal, define your env vars at the OS/shell level. This works everywhere with one setup.
Configure at the OS / shell level
Define variables once at the OS or shell level to ensure they're available to all terminals and, after reloading VS Code, to the dbt VS Code extension as well. Even if you close a terminal window, the variables will remain available to you.
Follow these steps to configure environment variables at the OS or shell level:
- Mac / Linux
- Windows Cmd
- Open your shell configuration file in a text editor using the following commands: (If the file does not exist, create it using a text editor using
vi ~/.zshrcorvi ~/.bashrc).open -e ~/.zshrc ## for zsh (macOS)
nano ~/.bashrc ## for bash (Linux or older macOS) - Add your environment variables to the file. For example:
- For zsh (macOS):
## ~/.zshrc
export DBT_ENV_VAR1="my_value"
export DBT_ENV_VAR2="another_value" - For bash (Linux or older macOS):
## ~/.bashrc or ~/.bash_profile
export DBT_ENV_VAR1="my_value"
export DBT_ENV_VAR2="another_value"
- For zsh (macOS):
- Save and apply the changes using the
:wqcommand in the terminal. - Reload the shell by closing and reopening the terminal or running
source ~/.zshrcorsource ~/.bashrcin the terminal. - Then verify the variables by running
echo $DBT_ENV_VAR1andecho $DBT_ENV_VAR2in the terminal.
If you see the value printed back in the terminal, you're all set! These variables will now be available:
- In all future terminal sessions
- Inside VS Code (after you reload the window)
- For all dbt commands run in the terminal or the VS Code extension buttons
There are two main ways to create persistent environment variables on Windows: through PowerShell or the Environment Variables UI.
The following steps will explain how to configure environment variables using PowerShell.
PowerShell
- Run the following commands in PowerShell:
[Environment]::SetEnvironmentVariable("DBT_ENV_VAR1","my_value","User")
[Environment]::SetEnvironmentVariable("DBT_ENV_VAR2","another_value","User")
- This saves the variables permanently for your user account. (To make them available system-wide for all users, replace "User" with "Machine" (requires admin rights)).
- Then, restart VS Code or select Developer: Reload Window for changes to take effect.
- Verify the changes by running
echo $DBT_ENV_VAR1andecho $DBT_ENV_VAR2in the terminal.
GUI (Environment Variables)
- Press Start → search for Environment Variables → open Edit the system environment variables.
- Click Environment Variables….
- Under User variables, click New….
- Add the variables and values. For example:
- Variable name:
DBT_ENV_VAR1 - Variable value:
my_value
- Variable name:
- Repeat for any others, then click OK.
- Restart VS Code or Cursor.
- Verify the changes by running
echo $DBT_ENV_VAR1andecho $DBT_ENV_VAR2in the terminal.
Configure in the VS Code extension settings
You can configure environment variables directly in the User Settings interface or in the JSON file.
Something to keep in mind:
- Configuring in the User Settings works with the dbt extension buttons and menus (for LSP, "Show build menu," and so on).
- Not inherited by the VS Code terminal or external shells.
- Running a dbt command in the terminal won't fetch or use these variables.
To configure environment variables in the VS Code extension settings:
- Open the Command Palette (Cmd + Shift + P for Mac, Ctrl + Shift + P for Windows/Linux).
- Then select either Preferences: Open User Settings or Preferences: Open Settings (JSON) in the dropdown menu.
- Open User Settings
- Open Settings (JSON)
- Open the VS Code user settings page.
- Search for
dbt.environmentVariables. - In the dbt:Environment Variables section, add your item and value for the environment variables.
- Click Ok to save the changes.
- Reload the VS Code extension to apply the changes.
- Verify the changes by running a dbt command and checking the output.
- Open the JSON file.
- Add your environment variables as a JSON object to the
.vscode/settings.jsonfile in your dbt project. For example:{
"dbt.environmentVariables": {
"DBT_ENV_VAR1": "test_santi_value" // replace DBT_ENV_VAR1 and test_santi_value with your own variable and value
}
} - Save the changes.
- Reload the VS Code extension to apply the changes.
- Verify the changes by running a dbt command and checking the output.
Configure in the terminal session
Configure environment variables in the terminal session using the export command. Something to keep in mind:
- Doing so will make variables visible to commands that run in that terminal session only.
- It lasts only for the current session and opening a new terminal will lose the values.
- The built-in dbt VS Code extension buttons and menus will not pick these up.
To configure environment variables in the terminal session:
-
Run the following command in the terminal, replacing
DBT_ENV_VAR1andtest1with your own variable and value.- Mac / Linux
- Windows Cmd
- Windows PowerShell
export DBT_ENV_VAR1=test1Refer to Microsoft's documentation for more information on the
setcommand.set DBT_ENV_VAR1=test1Refer to Microsoft's documentation for more information on the
$env:syntax.$env:DBT_ENV_VAR1 = "test1" -
Verify the changes by running a dbt command and checking the output.
Troubleshooting
If you run into any issues, check out the troubleshooting section below.
More information about Fusion
Fusion marks a significant update to dbt. While many of the workflows you've grown accustomed to remain unchanged, there are a lot of new ideas, and a lot of old ones going away. The following is a list of the full scope of our current release of the Fusion engine, including implementation, installation, deprecations, and limitations:
- About the dbt Fusion engine
- About the dbt extension
- New concepts in Fusion
- Supported features matrix
- Installing Fusion CLI
- Installing VS Code extension
- Fusion release track
- Quickstart for Fusion
- Upgrade guide
- Fusion licensing
Was this page helpful?
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.











