Skip to content

Commit 4d7179b

Browse files
committed
fix: pii tag takes precedence over show_sample_rows tag
1 parent 7dddc77 commit 4d7179b

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

macros/edr/system/system_utils/get_pii_columns_from_parent_model.sql

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,21 @@
4949
{% for column_node in column_nodes.values() %}
5050
{% set all_column_tags_lower = elementary.get_column_tags(column_node) %}
5151

52-
{# Skip columns explicitly tagged to show sample rows (if feature is enabled) #}
53-
{% if enable_show_tags and elementary.lists_intersection(
54-
all_column_tags_lower, show_tags
55-
) | length > 0 %}
56-
{% continue %}
57-
{% endif %}
52+
{# PII takes precedence: only skip if show_sample_rows is set and pii is not #}
53+
{% set has_show_tag = (
54+
enable_show_tags
55+
and elementary.lists_intersection(
56+
all_column_tags_lower, show_tags
57+
)
58+
| length
59+
> 0
60+
) %}
61+
{% set has_pii_tag = (
62+
elementary.lists_intersection(all_column_tags_lower, pii_tags)
63+
| length
64+
> 0
65+
) %}
66+
{% if has_show_tag and not has_pii_tag %} {% continue %} {% endif %}
5867

5968
{% for pii_tag in pii_tags %}
6069
{% if pii_tag in all_column_tags_lower %}

macros/edr/system/system_utils/is_show_sample_rows_table.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@
1717
| list
1818
) %}
1919

20+
{# PII takes precedence: if model has a PII tag, show_sample_rows is ignored #}
21+
{% set raw_pii_tags = elementary.get_config_var("pii_tags") %}
22+
{% if raw_pii_tags is string %} {% set pii_tags = [raw_pii_tags | lower] %}
23+
{% else %} {% set pii_tags = (raw_pii_tags or []) | map("lower") | list %}
24+
{% endif %}
25+
{% if elementary.lists_intersection(model_tags, pii_tags) | length > 0 %}
26+
{% do return(false) %}
27+
{% endif %}
28+
2029
{% set intersection = elementary.lists_intersection(model_tags, show_tags) %}
2130
{% do return(intersection | length > 0) %}
2231
{% endmacro %}

0 commit comments

Comments
 (0)