-
Notifications
You must be signed in to change notification settings - Fork 1.1k
add instructions to configure env_vars #8071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: current
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| | <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 | |
There was a problem hiding this comment.
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 🤞
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this 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. |
There was a problem hiding this comment.
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 | |
There was a problem hiding this comment.
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 | |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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
this pr adds instructions on how to configure env_vars to vsce and fusion cli
raised internally
🚀 Deployment available! Here are the direct links to the updated files: