You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want a way to disable a post-hook enabled at a root level at a sub-directory level.
Describe alternatives you've considered
This is for a directory of custom materializations and hence have considered removing the {{ run_hooks(post_hooks, inside_transaction=True) }} section of the materialization template.
Who will this benefit?
Will benefit people writing custom materializations as they will want to materialize objects that have a different grant mechanism for example.
Are you interested in contributing this feature?
Yes
Anything else?
No
The text was updated successfully, but these errors were encountered:
@sfc-gh-pkommini Thanks for opening! This is a totally reasonable request. Today, pre/post hooks are additive when merged, same as tags, and there isn't a way to customize that behavior. I just opened #4108 to describe that problem in more detail.
For the time being, there are a few ways you could work around this limitation:
Reorganize your model subdirectories so that you can apply hooks at a subdirectory level, instead of a root level
Encode into your hook logic (or macro logic, assuming it calls a macro) a conditional check for whether the current model is configured with an undesirable materialization:
{% macro my_hook_macro() %}
{% if execute andconfig.get('materialized') !='my_custom_materialization' %}
{{ log("This isn't my custom materialization", info = true) }}
{% endif %}
{% endmacro %}
models:
+post-hook: "{{ my_hook_macro() }}"
I'm going to close this in favor of the broader proposal in #4108.
Is there an existing feature request for this?
Describe the Feature
I want a way to disable a post-hook enabled at a root level at a sub-directory level.
Describe alternatives you've considered
This is for a directory of custom materializations and hence have considered removing the
{{ run_hooks(post_hooks, inside_transaction=True) }}
section of the materialization template.Who will this benefit?
Will benefit people writing custom materializations as they will want to materialize objects that have a different grant mechanism for example.
Are you interested in contributing this feature?
Yes
Anything else?
No
The text was updated successfully, but these errors were encountered: