Post hooks that call macros get parsed with execute = False #2370
Describe the bug
Easier to read the steps to reproduce
Steps to reproduce
This macro is expected to fail, but it should fail because of
The macro fails on the
Why this is important
There's legit reasons why you'd want to use the
This came up because @willwnekowicz was using the following macro that generates "comment on" statements in Postgres (also works on Redshift)
Which database are you using dbt with?
The output of
The text was updated successfully, but these errors were encountered:
The problem here is that calls to
Anyway, tl;dr: Hooks are the special exception to don't nest your curlies. Changing your example to:
should fix it.
Reposting from slack...
That flow definitely makes sense.
and if I try nesting the curlies on that:
.. I get:
Though, hardcoding the arguments works:
…and that’s a good enough workaround for me!
@beckjake my thinking here is increasingly that we shouldn't store info like this at parse-time, and we'd instead be better served by re-capturing config calls at runtime. We can definitely still capture refs in hooks at parse-time, and I imagine we'll want to capture materialization configs (as ephemeral configs have nonlocal effects on other models) too.
Beyond that though, I don't think there's a good reason why we couldn't capture the args provided to
@jtcohen6 Thank you for the reply. What exactly my question was in a model while defining the config blocks in that we will include pre_hook/post_hook. But it is not accepting the multiple pre_hook/post_hook in a single config block. Is there any way to define the pre_hook/post_hook outside the config block.