Search⌘ K
AI Features

Project Variables

Explore how to define project variables in the dbt_project.yml file and use them in your dbt models with Jinja. Understand how variables like strings, integers, lists, and dictionaries can be referenced and passed via the CLI. This lesson helps you avoid hardcoding values and manage dynamic configurations efficiently.

Project variables are a good way to define and store some configuration values that can be used across the whole project. They’re especially useful to define default values in our project.

Defining variables in the project.yml file

Let’s say we’re managing dbt projects for a chain of stores. Each store is likely to have a similar dbt project, except that their name and identifier are different.

We can define shop_name and shop_id as project variables to avoid having to hardcode those values in every model and macro that we have. ...