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

apply policy to all models #43

Open
mbritton-neuroflow opened this issue Jul 7, 2022 · 6 comments
Open

apply policy to all models #43

mbritton-neuroflow opened this issue Jul 7, 2022 · 6 comments
Labels
question Further information is requested

Comments

@mbritton-neuroflow
Copy link

mbritton-neuroflow commented Jul 7, 2022

Is there a reason that
dbt run-operation apply_masking_policy --args '{"resource_type": "sources"}'
works for sources but not models? And that models need to have masking policies applied as a post-hook or on-run-end? I am able to run the above command with a resource_type of models but it does nothing.

It would be very helpful to have this feature to mitigate the difficulty of unapplying and reapplying masking policies when they change, because running all models can take a long time, but applying masking policies should be very quick.

@dweaver33
Copy link

Seems you're having the same issue as me here #42

@entechlog
Copy link
Owner

dbt run-operation apply_masking_policy --args '{"resource_type": "models"}'

This was never a supported feature of this package\macro. apply_masking_policy happens after each model run as a post hook, adding this support may need further development

@entechlog entechlog added the question Further information is requested label Aug 12, 2022
@Chobsz
Copy link

Chobsz commented Aug 23, 2022

Think my PullRequest might cover this issue, check out the readme-edits to see the added functionality.
Pull41

@mbritton-neuroflow
Copy link
Author

Yes, that looks like it meets intent! Thanks!

@lilitangsonos
Copy link

@entechlog In the instructions it says you can apply the masking policy by applying dbt run -- model <model-name> which it doesn't seem like this works. It needs to be done in the post hook as you also mentioned in #42. Should probably remove that instruction unless I'm misunderstanding here...

@mgeerken
Copy link

Is it an ongoing discussion? 'Cause in the readme it still claims an on-run-end would work, but the macro is checking on the resource_type which is "macro" on an on-run-end.

Alternatively, you can also apply the masking policies by specifying below post-hook OR on-run-end to dbt_project.yml

{% set model_resource_type = model.resource_type | string %} {% if model_resource_type|lower in ["model", "snapshot"] %}

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

No branches or pull requests

6 participants