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
The model is executed and the need_to_know policy tag is added to the field column. Now if we decide that we no longer want the need_to_know policy tag attached to the field column, one would think that removing the policy_tags property would remove the policy tags (similar to the behavior of the description property).
models:
- name: policy_tag_table
columns:
- name: field
However, this does not remove the policy tags. Currently, to use dbt to remove the policy tags, an empty list of policy tags needs to be provided instead:
models:
- name: policy_tag_table
columns:
- name: field
policy_tags:
-
github-actionsbot
changed the title
[Bug] Removing the policy_tags property from a column does not remove the policy tag(s)
[CT-1332] [Bug] Removing the policy_tags property from a column does not remove the policy tag(s)
Oct 11, 2022
Thanks for reporting this along with an excellent write-up @nolan-jardine !
Agreed with your expectation that removing the policy_tags property from a column will remove the policy tags from that column, just like the behavior of the description property. (For the curious, policy_tags was originally implemented in dbt-labs/dbt-core#2589 and has been essentially unchanged since.)
I think this is a easy modification to make, and the logic for description and policy_tags happen to be right next to each other:
where DEFAULT_VALUE_WHEN_NULL is replaced with the applicable default value (e.g., something like "" or []) OR removed altogether if None is the applicable default. The implementer would need to suss out the applicable default value here.
Bonus points for an implementation that makes sure there are functional tests for both adding and removing descriptions and policy_tagss.
I'm going to label this as a "good_first_issue" for an interested open-source contributor to pick up.
Is this a new bug in dbt-bigquery?
Current Behavior
Policy tags cannot be removed from columns by removing the policy_tags property.
Expected Behavior
Removing the
policy_tags
property from a column will remove the policy tags from that column that dbt initially added.Steps To Reproduce
As an example, let's say we define the model's corresponding
.yml
file as follows:With the following definition:
The model is executed and the
need_to_know
policy tag is added to thefield
column. Now if we decide that we no longer want theneed_to_know
policy tag attached to thefield
column, one would think that removing thepolicy_tags
property would remove the policy tags (similar to the behavior of thedescription
property).However, this does not remove the policy tags. Currently, to use dbt to remove the policy tags, an empty list of policy tags needs to be provided instead:
Relevant log output
No response
Environment
Additional Context
No response
The text was updated successfully, but these errors were encountered: