How to Select Models by State in dbt

Last updated July 25, 2026 · By the SaturnSQL team

state:modified selects models that changed compared to a previous manifest.json, enabling slim CI: dbt build --select state:modified+ --state ./prod-artifacts rebuilds only what changed and its children. Add --defer to read unchanged parents from prod.

# compare against artifacts from the last prod run
dbt build --select state:modified+ --state ./prod-artifacts --defer

How it works

Save the target/manifest.json from a production run, then point --state at that directory. dbt diffs each node against it: state:modified matches changed nodes, state:new matches nodes missing from the old manifest. With --defer, refs to unselected models resolve to the prod objects, so CI does not have to rebuild the whole upstream DAG.

Useful state selectors

dbt ls --select state:modified --state ./prod-artifacts
dbt test --select state:modified+ --state ./prod-artifacts --defer

Run this in SaturnSQL

SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.

Try it free

Related dbt guides

© 2026 Panda Capital Oy Ab. All rights reserved.