Skip to content

Conversation

@mirnawong1
Copy link
Contributor

@mirnawong1 mirnawong1 commented Oct 22, 2025

@mirnawong1 mirnawong1 requested a review from a team as a code owner October 22, 2025 15:23
@vercel
Copy link

vercel bot commented Oct 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
docs-getdbt-com Ready Ready Preview Oct 24, 2025 4:18pm

@github-actions github-actions bot added content Improvements or additions to content Docs team Authored by the Docs team @dbt Labs labels Oct 22, 2025
| <div style={{width:'200px'}}>Where to configure</div> | Info | Stays active | Best for |
|---|---|---|---|
| [OS / shell (recommended)](#configure-at-the-os--shell-level) | Configure at the OS / shell level.<br /><br /> Affects all terminals _and_ the dbt extension (after VS Code reload) | Yes<br /> (across sessions) | Using both extension buttons _and_ terminal commands |
| [dbt VS Code extension settings](#configure-in-the-vs-code-extension-settings) | Configure directly in the [User Settings](vscode://settings/dbt.environmentVariables) interface or in the [JSON](vscode://command/workbench.action.openSettingsJson) file.<br /><br /> Affects the dbt LSP, compile-on-save, extension menus/buttons | Yes<br /> (per VS Code settings) | Editor-only workflows |
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the vscode:// link SHOULD hopefully open vscode directly to those settings 🤞

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if they're using Cursor?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also set in .env file in the root of the project/workspace, and the dbt VSCE will load on startup. If you edit the file, you will need to "reload window" for the changes to take effect (same as VSCE Settings)


## Configure environment variables

You need to configure [environment variables](/docs/build/environment-variables) (for example, [`DBT_ENV_VAR1`](/reference/dbt-jinja-functions/env_var)) 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).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to say they need to configure environment variables to use the extension features, we should expand on this and add it to the prerequisites up top. How will the extension features be restricted if they don't configure them? This is only for dbt cloud platform users too, correct?

</TabItem>
</Tabs>

#### Configure in the terminal session
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a benefit to using this method? It seems like we shouldn't even list it as an option and recommend against doing it

</TabItem>
</Tabs>
#### Configure in the VS Code extension settings
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we even list this and the below options? Maybe we should only list the system level installation. Why would they want to use this method?

Copy link
Collaborator

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mirnawong1 Thank you for the work to document this! It feels pretty clear to me that the current experience is clunky and inconsistent - we need to make it better!

export DBT_ENV_VAR1="my_value"
export DBT_ENV_VAR2="another_value"
```
3. Save and apply the changes using the `:wq` command in the terminal.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:wq is specific to vim - you can just say, "save the file and start a new shell session"


| <div style={{width:'200px'}}>Where to configure</div> | Info | Stays active | Best for |
|---|---|---|---|
| [OS / shell (recommended)](#configure-at-the-os--shell-level) | Configure at the OS / shell level.<br /><br /> Affects all terminals _and_ the dbt extension (after VS Code reload) | Yes<br /> (across sessions) | Using both extension buttons _and_ terminal commands |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From some quick testing - I can confirm this works for running dbtf commands in terminal/shell, but I don't believe this works for VSCE

| <div style={{width:'200px'}}>Where to configure</div> | Info | Stays active | Best for |
|---|---|---|---|
| [OS / shell (recommended)](#configure-at-the-os--shell-level) | Configure at the OS / shell level.<br /><br /> Affects all terminals _and_ the dbt extension (after VS Code reload) | Yes<br /> (across sessions) | Using both extension buttons _and_ terminal commands |
| [dbt VS Code extension settings](#configure-in-the-vs-code-extension-settings) | Configure directly in the [User Settings](vscode://settings/dbt.environmentVariables) interface or in the [JSON](vscode://command/workbench.action.openSettingsJson) file.<br /><br /> Affects the dbt LSP, compile-on-save, extension menus/buttons | Yes<br /> (per VS Code settings) | Editor-only workflows |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also set in .env file in the root of the project/workspace, and the dbt VSCE will load on startup. If you edit the file, you will need to "reload window" for the changes to take effect (same as VSCE Settings)

| [Terminal session](#configure-in-the-terminal-session) | Configure in the terminal session using the `export` command.<br /><br /> Affects the current terminal window _only_. | No<br /> (per session) | Quick, temporary testing |

:::tip Recommendation
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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced this actually works! Also, I don't love encouraging users to stick their dbt-specific env vars within their global OS user settings / shell profiles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

content Improvements or additions to content Docs team Authored by the Docs team @dbt Labs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants