dbt · dbt Fundamentals

Where to configure materialization

Easyconfigmaterializationdbt_project.ymlyaml

Interview question

Where can you configure a model's materialization in dbt?

How to answer

The short answer

You can set materialization (and other configs) in three common places. More specific settings win over more general ones.

1. Inside the model (most specific)

SQL
{{ config(materialized='table') }}

select * from {{ ref('stg_orders') }}

2. In a YAML properties / schema file

YAML
models:
  - name: fct_orders
    config:
      materialized: incremental
      unique_key: order_id

3. In dbt_project.yml (folder / project defaults)

YAML
models:
  my_project:
    staging:
      +materialized: view
    marts:
      +materialized: table

The + prefix in dbt_project.yml means "apply this config to models in this folder tree."

Precedence (mental model)

Practical pattern

  • Put layer defaults in dbt_project.yml (staging = view, marts = table).
  • Override special models in the file or YAML (one huge fact → incremental).

Interview tip: Mention hierarchy: project defaults → YAML → inline config(). Interviewers want to hear you avoid sprinkling materialized='table' on every file when a folder default would do.