execute_hooks_on_any_reuse
- Project YAML file
- Properties YAML file
- SQL file config
dbt_project.yml
models:
<resource-path>:
+state:
execute_hooks_on_any_reuse: true | false
models/<filename>.yml
models:
- name: my_model
config:
state:
execute_hooks_on_any_reuse: true | false
models/<filename>.sql
{{ config(
state={
"execute_hooks_on_any_reuse": true | false
}
) }}
Definition
When dbt State skips a node because it's still fresh, that node's pre- and post-hooks are not executed by default. This matches dbt's standard behavior: if the node wasn't executed, its hooks don't run.
Set execute_hooks_on_any_reuse: true if you have audit hooks or other hooks that must run on every job invocation, regardless of whether the node was rebuilt or reused.
| Loading table... |
Hooks always execute when dbt State clones a node from another environment, because the clone step creates a new object in the warehouse.
Example
Always run audit hooks
Use execute_hooks_on_any_reuse: true for nodes with audit or lineage hooks that must run on every job invocation:
models/fct_orders.yml
models:
- name: fct_orders
config:
state:
execute_hooks_on_any_reuse: true
post-hook:
- "INSERT INTO audit_log VALUES ('{{ model.name }}', CURRENT_TIMESTAMP())"
Related docs
Was this page helpful?
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
0