Skip to main content

dbt State configurations

When you run a dbt command with dbt State enabled, dbt compares a node's logic and data against previous builds and takes the most efficient path:

  • Reuse — if the object exists in the target schema, its logic hasn't changed, and its parents haven't received fresh data exceeding its lag_tolerance, the node is reused.
  • Clone — if reuse isn't possible but the object exists in the deferred environment with the same logic and sufficiently fresh data, dbt State clones it.
  • Normal build — if neither reuse nor clone is possible, the node builds as normal, using deferral for any unselected upstream nodes.

Use the following configs to control how dbt State makes these decisions.

dbt_project.yml
models:
+state:
lag_tolerance: <duration>
require_fresh_data_from: any | all
evaluate_volatile_sql: true | false
pre_clone: never | if_missing | always
execute_hooks_on_any_reuse: true | false
ConfigDefaultScopeDescription
lag_tolerance45mNode, folder, or project-level via model configHow much time must pass since the last upstream data change before a node is eligible for a rebuild.
require_fresh_data_fromanyNode, folder, or project-level via model configWhether any or all direct parents need fresh data before a node is eligible for a rebuild.
pre_cloneif_missingNode, folder, or project-level via model configWhether dbt State pre-populates incremental models and snapshots by cloning production before a run.
execute_hooks_on_any_reusefalseNode, folder, or project-level via model configWhether pre- and post-hooks run when a node is reused without rebuilding.
evaluate_volatile_sqlfalseNode, folder, or project-level via model configWhether dbt State stores and compares the runtime output of volatile SQL functions when deciding whether to rebuild.
defer_to_targetprodProfile(Self-managed only) Which profile target dbt State defers to.
metadata_warehouseProfile warehouseProfile(Snowflake only) A separate warehouse for dbt State metadata lookups.
Loading table...

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

0
Loading