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)
{{ config(materialized='table') }}
select * from {{ ref('stg_orders') }}2. In a YAML properties / schema file
models:
- name: fct_orders
config:
materialized: incremental
unique_key: order_id3. In dbt_project.yml (folder / project defaults)
models:
my_project:
staging:
+materialized: view
marts:
+materialized: tableThe + prefix in dbt_project.yml means "apply this config to models in this folder tree."
Precedence (mental model)
dbt_project.yml (folder defaults)
↑ overridden by
model YAML config
↑ overridden by
{{ config(...) }} in the .sql filePractical 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.