Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post-hook executed as a pre-hook #59

Open
alecoules opened this issue Jan 23, 2023 · 2 comments
Open

Post-hook executed as a pre-hook #59

alecoules opened this issue Jan 23, 2023 · 2 comments
Assignees

Comments

@alecoules
Copy link

alecoules commented Jan 23, 2023

Hi,

Thanks for your work !
I use this pkg to set a masking policy on one of my table. To set it I use a post-hook in the suitable model.
But I have a strange behavior: when I add it in my dbt_project.yml, it works fine:
models: analytics: result: +post-hook: - "{{ config(post_hook=dbt_snow_mask.apply_masking_policy('models')) }}"
But when I add it directly in the sql file defining my model it's launched as a pre-hook (resulting in the creation of a table with no masking policy):
{{ config( post_hook=dbt_snow_mask.apply_masking_policy('models') ) }}
I managed to reproduce it at will.
Don't hesitate if you need further details.

Bests,
Arnaud

@snirisl
Copy link

snirisl commented Mar 30, 2023

Can confirm I experience the same here - it is triggered as pre-hook, before the table is created

@entechlog entechlog self-assigned this Apr 2, 2023
@entechlog
Copy link
Owner

Hello @alecoules @snirisl,

Thanks for catching this issue. It seems the bug is due to a wrong syntax in documentation. Can you please try updating the post hook in model to below statement and confirm if it is working correctly ?

{{ config(post_hook = "{{ dbt_snow_mask.apply_masking_policy('models') }}") }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants