dbt_project.yml
Every dbt project needs a dbt_project.yml file — this is how dbt knows a directory is a dbt project. It also contains important information that tells dbt how to operate your project.
-
dbt uses YAML in a few different places. If you're new to YAML, it would be worth learning how arrays, dictionaries, and strings are represented.
-
By default, dbt looks for the
dbt_project.ymlin your current working directory and its parents, but you can set a different directory using the--project-dirflag or theDBT_PROJECT_DIRenvironment variable. -
Specify your dbt Cloud project ID in the
dbt_project.ymlfile usingproject-idunder thedbt-cloudconfig. Find your project ID in your dbt Cloud project URL: For example, inhttps://YOUR_ACCESS_URL/11/projects/123456, the project ID is123456. -
Note, you can't set up a "property" in the
dbt_project.ymlfile if it's not a config (an example is macros). This applies to all types of resources. Refer to Configs and properties for more detail.
Example
The following example is a list of all available configurations in the dbt_project.yml file:
Naming convention
It's important to follow the correct YAML naming conventions for the configs in your dbt_project.yml file to ensure dbt can process them properly. This is especially true for resource types with more than one word.
-
Use dashes (
-) when configuring resource types with multiple words in yourdbt_project.ymlfile. Here's an example for saved queries:dbt_project.ymlsaved-queries: # Use dashes for resource types in the dbt_project.yml file.
my_saved_query:
+cache:
enabled: true -
Use underscore (
_) when configuring resource types with multiple words for YAML files other than thedbt_project.ymlfile. For example, here's the same saved queries resource in thesemantic_models.ymlfile:models/semantic_models.ymlsaved_queries: # Use underscores everywhere outside the dbt_project.yml file.
- name: saved_query_name
... # Rest of the saved queries configuration.
config:
cache:
enabled: true