Open jeremyyeo opened 2 weeks ago
Thanks for reaching out about this @jeremyyeo !
In general, hyphens have been for dbt_project.yml
and underscores for other YAML files. But this delineation isn't easy for us humans to follow, and it's easy to flip-flop them (but hard to debug when it doesn't work as expected). This was surely the inspiration for https://github.com/dbt-labs/dbt-core/issues/9235 to broadly solve this.
The particular issue you raised looks similar to https://github.com/dbt-labs/dbt-core/pull/6435 -- but precisely the other way around. Maybe the solution could be as simple as extending the code added in https://github.com/dbt-labs/dbt-core/pull/10603 to include pre-hook
and post-hook
?
A/C is tests for this 2x3 matrix from technical refinement:
Also separately check that hooks serializes/deserialize properly in manifest.json
node objects
Is this a new bug in dbt-core?
Current Behavior
When setting hooks in
properties.yml
files, our docs (https://docs.getdbt.com/reference/resource-configs/pre-hook-post-hook) point out that we should dopost_hook
instead ofpost-hook
. However,post-hook
still appear to work - but not fully ({{ ref() }}
and{{ this }}
) don't get resolved like if we usedpost_hook
.We should make them both work the same way or just stop
post-hook
from being a thing evaluated at all.Expected Behavior
Either:
post-hook
is ignored inproperties.yml
.post-hook
andpost_hook
work the same way when resolving{{ ref() }} / {{ this }}
(and maybe other conditions? not sure).Steps To Reproduce
^ We can see did try to run the "hook" but
{{ this }}
didn't get resolved:Let's modify our yaml:
Relevant log output
No response
Environment
Which database adapter are you using with dbt?
snowflake
Additional Context
If you tried to use
ref()
inpost-hook
- you'll get aref()
is undefined error. But if usingref()
inpost_hook
- it's all good.Also tried on older dbt versions (1.7) - same inconsistency there too.