0
0
dbtdata~5 mins

dbt_project.yml configuration

Choose your learning style9 modes available
Introduction

The dbt_project.yml file tells dbt how to run your project. It sets up important details like where your data models live and how to build them.

When you start a new dbt project and need to set its name and version.
When you want to tell dbt where your SQL models and tests are located.
When you want to configure how dbt builds models, like materializations (table, view).
When you want to set project-wide configurations like quoting or target schemas.
When you want to organize your project with folders and specify which files to include.
Syntax
dbt
name: your_project_name
version: '1.0'
config-version: 2

profile: your_profile_name

source-paths: ["models"]
analysis-paths: ["analysis"]
test-paths: ["tests"]

target-path: "target"
clean-targets: ["target", "dbt_modules"]

models:
  your_project_name:
    +materialized: view
    staging:
      +schema: staging
      +materialized: table

The name is your project name and must match your folder name.

Indentation matters because YAML uses spaces to organize settings.

Examples
Basic setup with project name, profile, and models materialized as tables.
dbt
name: sales_analytics
version: '1.0'
config-version: 2

profile: prod_profile

source-paths: ["models"]

models:
  sales_analytics:
    +materialized: table
Different folders have different schemas and materializations.
dbt
models:
  sales_analytics:
    staging:
      +schema: staging
      +materialized: incremental
    marts:
      +schema: marts
      +materialized: view
Sample Program

This dbt_project.yml configures a project named my_dbt_project. It sets the default materialization to view. The staging folder models build as tables in the staging schema. The marts folder models build incrementally in the marts schema.

dbt
name: my_dbt_project
version: '1.0'
config-version: 2

profile: default

source-paths: ["models"]
test-paths: ["tests"]

target-path: "target"
clean-targets: ["target", "dbt_modules"]

models:
  my_dbt_project:
    +materialized: view
    staging:
      +schema: staging
      +materialized: table
    marts:
      +schema: marts
      +materialized: incremental
OutputSuccess
Important Notes

The dbt_project.yml file must be in your project root folder.

Use two spaces for indentation to avoid YAML errors.

You can override settings for specific folders or models under the models: section.

Summary

dbt_project.yml tells dbt how to run your project.

It sets project name, version, file paths, and model build settings.

Indentation and correct YAML format are important for it to work.