dbt: What Are child_map and parent_map in dbt’s Manifest?


In manifest.json, dbt maintains a compiled dependency graph of your project. Two special sections make this graph traversable:

SectionPurpose
parent_mapLists all upstream nodes for a model.
child_mapLists 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

FeatureValue
🔄 Bidirectional dependenciesEnables both forward (+) and backward (+model) DAG navigation
⚡️ Faster incremental runsdbt quickly identifies affected nodes
🧩 Scales to large projectsAvoids full DAG traversal during builds
🧪 Selective testingUsed by dbt test --select model+ to limit scope

🧼 Summary

  • parent_map and child_map = the backbone of dbt’s DAG resolution logic.
  • They’re stored in the manifest.json file inside target/ after each dbt compile or dbt run.
  • These maps make incremental processing possible and efficient — especially in large projects.

Leave a Reply

Your email address will not be published. Required fields are marked *