[Bug] state:modified
detection incorrect when config() block generated by macro with dynamic sql_header
#11150
Labels
bug
Something isn't working
sql_header
Issues related to `sql_header` config
state
Stateful selection (state:modified, defer)
Is this a new bug in dbt-core?
Current Behavior
IF:
config()
block, is generated via a macroset_sql_header
generating a dynamic header based on config or the model--state
flag,then
state:modified
detection always returns that the model has changed. See "Steps to Reproduce" for a minimal reproducible example.Expected Behavior
state:modified
should not detect a change when no model sources or macros involved have changed.Steps To Reproduce
This occurs even with
state_modified_compare_more_unrendered_values
set as true:The bug does not occur if
set_sql_header
in the macro has a constant body (e.g.select TIMESTAMP("1970-01-01")
). The bug also does not occur if the model is not generated entirely via macro.The bug can be avoided if a dummy
config()
statement is put in the model source:and
foo_shim
does not show as modified when running the same above statement.Relevant log output
Environment
Which database adapter are you using with dbt?
bigquery
Additional Context
No response
The text was updated successfully, but these errors were encountered: