Skip to content

Commit

Permalink
to address pr #1252 (#3697)
Browse files Browse the repository at this point in the history
this pr addresses @amychen1776 's old pr #1252, which has a merge
conflict and provides a flag about databricks sql warehouses (fka sql
endpoints). [see
slack](https://dbt-labs.slack.com/archives/C017GDLAF7D/p1688985469949789)
  • Loading branch information
mirnawong1 authored Jul 12, 2023
2 parents 7271ffc + eba70a7 commit bace41d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion website/docs/docs/build/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,13 @@ Environment variables can be used in many ways, and they give you the power and
Now that you can set secrets as environment variables, you can pass git tokens into your package HTTPS URLs to allow for on-the-fly cloning of private repositories. Read more about enabling [private package cloning](/docs/build/packages#private-packages).

#### Dynamically set your warehouse in your Snowflake connection
Environment variables make it possible to dynamically change the Snowflake virtual warehouse size depending on the job. Instead of calling the warehouse name directly in your project connection, you can reference an environment variable which will get set to a specific virtual warehouse at runtime.
Environment variables make it possible to dynamically change the Snowflake virtual warehouse size depending on the job. Instead of calling the warehouse name directly in your project connection, you can reference an environment variable which will get set to a specific virtual warehouse at runtime.

For example, suppose you'd like to run a full-refresh job in an XL warehouse, but your incremental job only needs to run in a medium-sized warehouse. Both jobs are configured in the same dbt Cloud environment. In your connection configuration, you can use an environment variable to set the warehouse name to `{{env_var('DBT_WAREHOUSE')}}`. Then in the job settings, you can set a different value for the `DBT_WAREHOUSE` environment variable depending on the job's workload.

Currently, it's not possible to dynamically set environment variables across models within a single run. This is because each env_var can only have a single set value for the entire duration of the run.

**Note** — You can also use this method with Databricks SQL Warehouse.

<Lightbox src="/img/docs/dbt-cloud/using-dbt-cloud/Environment Variables/warehouse-override.png" title="Adding environment variables to your connection credentials"/>

Expand Down

0 comments on commit bace41d

Please sign in to comment.