Summary
Build the models whose files changed in the current branch. Skip the manual selector typing.
Why
During iteration you keep rebuilding the same handful of models. dbt's state:modified+ exists but needs manifest plumbing most teams don't have set up. A git-diff-based shortcut is good enough for the daily loop and zero-config.
Sketch
git diff --name-only <ref>...HEAD -- models/ → list of changed .sql files.
- Map paths to model names (file stem in most projects; could resolve via manifest for accuracy).
- Forward to
dbts build --select <model1>+ <model2>+ ....
--ref main flag for the diff base; default main.
--no-descendants to skip the + suffix when you only want the changed nodes themselves.
Where it'd live
- New
src/dbts/run_changed.py.
- Reuse
dbt_runner.run and _promote_selectors from cli.py.
Effort
Medium — main complexity is path → model-name mapping (dbt allows custom alias / different file layout).
Tier
Tier 1 — recommended (daily-loop speedup).
Related
- Pairs with
dbts impact (downstream blast-radius for the same set of changed models).
Summary
Build the models whose files changed in the current branch. Skip the manual selector typing.
Why
During iteration you keep rebuilding the same handful of models. dbt's
state:modified+exists but needs manifest plumbing most teams don't have set up. A git-diff-based shortcut is good enough for the daily loop and zero-config.Sketch
git diff --name-only <ref>...HEAD -- models/→ list of changed.sqlfiles.dbts build --select <model1>+ <model2>+ ....--ref mainflag for the diff base; defaultmain.--no-descendantsto skip the+suffix when you only want the changed nodes themselves.Where it'd live
src/dbts/run_changed.py.dbt_runner.runand_promote_selectorsfromcli.py.Effort
Medium — main complexity is path → model-name mapping (dbt allows custom alias / different file layout).
Tier
Tier 1 — recommended (daily-loop speedup).
Related
dbts impact(downstream blast-radius for the same set of changed models).