dbt-snow-mask
dbt-snow-mask copied to clipboard
Macro to allow creation and altering of masking policies - Issue #6
The macro create_alter_masking_policy
has been added. It checks to see if the masking policy exists. If it does not, it creates the masking policy. If the masking policy does exist, it performs the command 'ALTER MASKING POLICY ... SET BODY'. This allows the body of a masking policy to be changed without having to remove the assignments of the masking policy to tables/views.
This pull request also introduces a different way for specifying the macro that defines the masking policy. Rather than creating a macro that has the 'CREATE OR REPLACE MASKING POLICY ...' statement, you specify the parts of the masking policy definition in yaml metadata variables and then call the create_alter_masking_policy
macro to do the work.
The new macro create_masking_policy_mp_mask_timestamp
uses that method.