Skip to main content

execute_hooks_on_any_reuse

dbt_project.yml
models:
<resource-path>:
+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.

ValueBehavior
false (default)Hooks are skipped when a node is reused without rebuilding.
trueHooks run even when a node is 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())"

Was this page helpful?

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

0
Loading