Bird
Raised Fist0
dbtdata~10 mins

dbt_project.yml configuration - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - dbt_project.yml configuration
Start: Create dbt_project.yml
↓
Define project name
↓
Set version
↓
Configure profile name
↓
Set source-paths
↓
Set target-path
↓
Configure models settings
↓
Save and run dbt
↓
End
This flow shows how you create and configure the dbt_project.yml file step-by-step to set up your dbt project.
Execution Sample
dbt
name: 'my_dbt_project'
version: '1.0'
profile: 'default'
source-paths: ['models']
target-path: 'target'
models:
  my_dbt_project:
    +materialized: view
This config sets the project name, version, profile, source and target paths, and model materialization to view.
Execution Table
StepConfig KeyValue SetEffect
1name'my_dbt_project'Sets the project name
2version'1.0'Defines project version
3profile'default'Links to profile for DB connection
4source-paths['models']Where dbt looks for model files
5target-path'target'Where compiled files are saved
6models.my_dbt_project.+materializedviewSets models to materialize as views
7Run dbtN/Adbt uses this config to build models
💡 All config keys set, dbt ready to run with these settings
Variable Tracker
Config KeyInitialSet ValueFinal
nameNone'my_dbt_project''my_dbt_project'
versionNone'1.0''1.0'
profileNone'default''default'
source-pathsNone['models']['models']
target-pathNone'target''target'
models.my_dbt_project.+materializedNoneviewview
Key Moments - 3 Insights
Why do we set 'profile' in dbt_project.yml?
The 'profile' key tells dbt which database connection settings to use, linking to your profiles.yml file. See execution_table step 3.
What happens if 'source-paths' is set incorrectly?
dbt won't find your model files and won't build them. This is shown in execution_table step 4 where source-paths is set to ['models'].
Why do we use '+materialized: view' under models?
This sets all models in the project to be materialized as views instead of tables. See execution_table step 6.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what value is set for 'profile' at step 3?
A'default'
B'my_dbt_project'
C'1.0'
D'target'
💡 Hint
Check the 'Value Set' column in execution_table row with Step 3
At which step does the configuration specify where dbt looks for model files?
AStep 6
BStep 2
CStep 4
DStep 5
💡 Hint
Look for 'source-paths' in the Config Key column of execution_table
If you change '+materialized' from 'view' to 'table', which step in execution_table changes?
AStep 3
BStep 6
CStep 4
DStep 5
💡 Hint
Check the step where '+materialized' is set in execution_table
Concept Snapshot
dbt_project.yml configures your dbt project.
Key settings: name, version, profile (DB connection), source-paths (model files), target-path (compiled files).
Models section sets how models build (e.g., materialized as views or tables).
Save and run dbt to apply these settings.
Full Transcript
This visual execution shows how to configure the dbt_project.yml file step-by-step. First, you set the project name and version. Then, you specify the profile to connect to your database. Next, you tell dbt where to find your model files with source-paths and where to save compiled files with target-path. Finally, you configure model settings like materialization type. Each step updates the configuration variables. When all are set, dbt uses this file to build your project models correctly.

Practice

(1/5)
1. What is the primary purpose of the dbt_project.yml file in a dbt project?
easy
A. To configure project settings like name, version, and model paths
B. To write SQL queries for data transformation
C. To store raw data files for analysis
D. To define user access permissions for the project

Solution

  1. Step 1: Understand the role of dbt_project.yml

    This file tells dbt how to run the project by setting configurations.
  2. Step 2: Identify what configurations it includes

    It sets project name, version, file paths, and model build settings, not SQL or data files.
  3. Final Answer:

    To configure project settings like name, version, and model paths -> Option A
  4. Quick Check:

    Project configuration = To configure project settings like name, version, and model paths [OK]
Hint: Remember: dbt_project.yml sets project-wide settings [OK]
Common Mistakes:
  • Confusing dbt_project.yml with SQL model files
  • Thinking it stores data instead of configurations
  • Assuming it manages user permissions
2. Which of the following is the correct YAML syntax to set the project name to "my_dbt_project" in dbt_project.yml?
easy
A. project_name: my_dbt_project
B. project: "my_dbt_project"
C. project-name: my_dbt_project
D. name: my_dbt_project

Solution

  1. Step 1: Recall the correct key for project name in dbt_project.yml

    The key to set the project name is name, not project_name or others.
  2. Step 2: Check YAML syntax

    YAML uses key: value pairs, so name: my_dbt_project is correct syntax.
  3. Final Answer:

    name: my_dbt_project -> Option D
  4. Quick Check:

    Project name key = name [OK]
Hint: Use name: to set project name in YAML [OK]
Common Mistakes:
  • Using underscores or hyphens incorrectly in key names
  • Putting project name under wrong key
  • Using quotes unnecessarily or missing them when needed
3. Given this snippet in dbt_project.yml:
models:
  my_project:
    materialized: table
    schema: analytics
What will be the materialization type and schema for models in the my_project namespace?
medium
A. Materialized as views, schema is default
B. Materialized as tables, schema is analytics
C. Materialized as incremental, schema is analytics
D. Materialized as tables, schema is default

Solution

  1. Step 1: Read the materialized setting under models.my_project

    The setting materialized: table means models will be built as tables.
  2. Step 2: Check the schema setting

    The schema is explicitly set to analytics, so models will be created in that schema.
  3. Final Answer:

    Materialized as tables, schema is analytics -> Option B
  4. Quick Check:

    Materialized = table, schema = analytics [OK]
Hint: Look for materialized and schema keys under models [OK]
Common Mistakes:
  • Assuming default schema when schema is set
  • Confusing materialized types like view vs table
  • Ignoring indentation that defines scope
4. Identify the error in this dbt_project.yml snippet:
name: my_project
version: 1.0
models:
  my_project:
    materialized: table
    schema analytics
medium
A. Version should be a string, not a number
B. Incorrect indentation for 'models' key
C. Missing colon after 'schema' key
D. Project name should be under 'project' key

Solution

  1. Step 1: Check YAML syntax for key-value pairs

    Each key must be followed by a colon and a space before the value. Here, schema analytics misses the colon.
  2. Step 2: Verify other parts

    Indentation and version format are correct; project name uses correct key name.
  3. Final Answer:

    Missing colon after 'schema' key -> Option C
  4. Quick Check:

    YAML key-value needs colon [OK]
Hint: Check every key has a colon and space before value [OK]
Common Mistakes:
  • Forgetting colon after keys
  • Wrong indentation levels
  • Using wrong keys for project name
5. You want to configure your dbt project so that all models in the sales folder are materialized as incremental and use the schema sales_data. Which dbt_project.yml snippet correctly achieves this?
hard
A. models: sales: +materialized: incremental +schema: sales_data
B. models: sales: materialized: incremental schema: sales_data
C. models: sales: materialized: incremental +schema: sales_data
D. models: sales: +materialized: incremental schema: sales_data

Solution

  1. Step 1: Understand dbt config syntax for folder-level overrides

    To set configs for all models in a folder, use the '+' prefix before keys.
  2. Step 2: Check which options use '+' for both keys

    Both materialized and schema need '+' prefix to apply to all models in sales folder.
  3. Final Answer:

    models: sales: +materialized: incremental +schema: sales_data -> Option A
  4. Quick Check:

    Folder configs use '+' prefix [OK]
Hint: Use '+' before keys to apply configs to all models in a folder [OK]
Common Mistakes:
  • Missing '+' prefix for folder-level configs
  • Using '+' on only one key instead of both
  • Confusing folder name with project name
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard