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.
- Project YAML file
- Properties YAML file
- SQL file config
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
models/schema.yml
models:
- name: <model_name>
config:
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
models/<filename>.sql
{{ config(
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
}
) }}
| Loading table... |
Related docs
Was this page helpful?
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
0