What is the main purpose of the dbt_project.yml file in a dbt project?
Think about where dbt stores project-wide settings.
The dbt_project.yml file is the main configuration file for a dbt project. It sets paths, versions, and default behaviors like materializations.
Given this snippet from dbt_project.yml:
models:
my_project:
+materialized: view
staging:
+materialized: tableWhat materialization will the model staging.orders use?
Check if there is a more specific setting for staging models.
The staging folder has a specific materialization set to table, which overrides the project-level view setting.
Consider this dbt_project.yml snippet:
source-paths: - models - analysis
If you add a new SQL model file under analysis/, will dbt compile it as a model?
Think about the difference between models and analysis directories in dbt.
The analysis directory is for analysis files, not models. Even if included in source-paths, dbt does not compile analysis files as models.
What error will occur with this dbt_project.yml snippet?
models:
my_project:
+materialized: table
+schema: analytics
staging:
+materialized: incremental
+schema: staging_dataCheck YAML indentation and valid dbt config keys.
The snippet is correctly indented and uses valid dbt config keys. Incremental materialization and schema overrides are allowed.
Given this dbt_project.yml snippet:
models:
my_project:
+schema: analytics
marts:
+schema: marts_schema
finance:
+schema: finance_schema
+materialized: tableWhat schema will the model marts.finance.revenue use?
Remember that nested configurations override parent settings.
The most specific schema setting applies. Here, finance_schema overrides marts_schema and analytics.