In manifest.json
, dbt maintains a compiled dependency graph of your project. Two special sections make this graph traversable:
Section | Purpose |
---|---|
parent_map | Lists all upstream nodes for a model. |
child_map | Lists all downstream nodes for a model. |
These are bidirectional mappings that allow dbt to:
- Know what needs to be rebuilt if a source/model/test changes.
- Avoid scanning the whole project every time a small change occurs.
- Enable intelligent re-runs (
dbt run --select model+
,dbt run --select +model
, etc.).
📦 Example: A Simple dbt Project
Let’s say you have the following models:
source('raw', 'orders')
↓
stg_orders
↓
dim_customers
↓
customer_lifetime_value
In manifest.json
, dbt builds:
🔼 parent_map
"parent_map": {
"model.my_project.stg_orders": ["source.my_project.raw_orders"],
"model.my_project.dim_customers": ["model.my_project.stg_orders"],
"model.my_project.customer_lifetime_value": ["model.my_project.dim_customers"]
}
🔽 child_map
"child_map": {
"source.my_project.raw_orders": ["model.my_project.stg_orders"],
"model.my_project.stg_orders": ["model.my_project.dim_customers"],
"model.my_project.dim_customers": ["model.my_project.customer_lifetime_value"]
}
🧠 How dbt Uses This for Incremental Builds
Imagine you run:
dbt run --select source:raw_orders+
dbt checks child_map
and knows exactly which models depend on raw_orders
:
stg_orders
dim_customers
customer_lifetime_value
So it only rebuilds these — no need to parse YAML files or scan the whole DAG.
Likewise, if you use:
dbt run --select +dim_customers
dbt looks up parent_map
to include:
stg_orders
raw_orders
✅ Benefits
Feature | Value |
---|---|
🔄 Bidirectional dependencies | Enables both forward (+) and backward (+model) DAG navigation |
⚡️ Faster incremental runs | dbt quickly identifies affected nodes |
🧩 Scales to large projects | Avoids full DAG traversal during builds |
🧪 Selective testing | Used by dbt test --select model+ to limit scope |
🧼 Summary
parent_map
andchild_map
= the backbone of dbt’s DAG resolution logic.- They’re stored in the
manifest.json
file insidetarget/
after eachdbt compile
ordbt run
. - These maps make incremental processing possible and efficient — especially in large projects.