Skip to content

feat: dbts run-changed — build models that changed in git #8

Description

@luiul

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions