In this article, we’ll dive into the various settings you can configure in this file, including project name, version, DBT version requirements, model paths, seed paths, test paths, analysis paths, macro paths, snapshot paths, docs paths, and vars.
Project Name and Version
The name
and version
fields in the dbt_project.yml
file define the name and version of your DBT project. This information is useful when sharing your project with others or when working on a team. Here’s an example of how to define these fields:
name: my_dbt_project
version: 1.0.0
DBT Version Requirements
The require-dbt-version
field in the dbt_project.yml
file specifies the minimum version of DBT required to run your project. This field is useful when you’re working with a team and want to ensure that everyone is using a compatible version of DBT. Here’s an example of how to specify the required DBT version:
require-dbt-version: ">0.19.0"
In this example, the >
symbol indicates that any version greater than 0.19.0
is acceptable.
Model Paths
The model-paths
field in the dbt_project.yml
file specifies the directories where your DBT models are stored. By default, DBT looks for models in the models
directory. However, you can specify additional directories if you want to organize your models differently. Here’s an example of how to specify multiple model paths:
model-paths:
- models/ecommerce
- models/finance
In this example, DBT will look for models in the ecommerce
and finance
directories in addition to the default models
directory.
Seed Paths
The seed-paths
field in the dbt_project.yml
file specifies the directories where your DBT seed files are stored. Seed files are used to load reference data into your data warehouse. By default, DBT looks for seed files in the data
directory. However, you can specify additional directories if you want to organize your seeds differently. Here’s an example of how to specify multiple seed paths:
seed-paths:
- data/ecommerce
- data/finance
In this example, DBT will look for seed files in the ecommerce
and finance
directories in addition to the default data
directory.
Test Paths
The test-paths
field in the dbt_project.yml
file specifies the directories where your DBT test files are stored. Test files are used to validate the data in your data warehouse and ensure that your DBT code is working as expected. By default, DBT looks for test files in the tests
directory. However, you can specify additional directories if you want to organize your tests differently. Here’s an example of how to specify multiple test paths:
test-paths:
- tests/ecommerce
- tests/finance
In this example, DBT will look for test files in the ecommerce
and finance
directories in addition to the default tests
directory.
Analysis Paths
The analysis-paths
field in the dbt_project.yml
file specifies the directories where your DBT analysis files are stored. Analysis files are used to run SQL queries that provide insights into your data. By default, DBT does not
Read Explain on DBTs models, snapshots, seeds, tests, macros, docs, sources, exposures, metrics, analysis
Get more useful articles on dbt