Skip to main content
The dbt_project.yml file is the core configuration file for any dbt project. It defines essential settings such as the project name, version, and model configurations, ensuring your project runs correctly and consistently.

Why dbt_project.yml Matters

The dbt_project.yml file serves several important functions:
  • Identifies the root of your dbt project
  • Configures project-wide settings
  • Sets default materializations for your models
  • Defines model-specific configurations
  • Controls directory paths and behaviors
A well-configured project file ensures consistent behavior across environments and team members.

Core Components of dbt_project.yml

Here’s a breakdown of the key sections and their purposes:

Project Metadata

This section defines:
  • name: A unique identifier for your project (used in compiled SQL)
  • version: Optional versioning for tracking project changes
  • config-version: The version of dbt’s configuration schema (should be 2 for current projects)

Profile Configuration

This tells dbt which profile to use from your profiles.yml file. Profiles define database connections and credentials.

Directory Paths

These settings define where dbt should look for different types of files:

Model Configuration

This section defines how your models should be materialized and configured:
Key points about model configuration:
  • Configuration is hierarchical - lower levels inherit from higher levels
  • The top-level project name must match your name value
  • The + prefix indicates a dbt configuration property
  • You can override configurations at any level

Seed Configuration

For controlling how CSV files are loaded into your database:

Variables

Define project-wide variables that can be used in models:

On-Run Hooks

Execute SQL before or after your dbt runs:

Cleaning Up Artifacts

Define which directories should be cleaned by dbt clean:

Complete Example

Here’s a complete example of a dbt_project.yml file:

Best Practices for dbt_project.yml


Common Issues and Solutions

Your dbt_project.yml file is a living document that will evolve with your project. Taking the time to configure it correctly will lead to a more maintainable and consistent dbt implementation.