Skip to content

Commit a1868a7

Browse files
committed
tags case insesitiveity
1 parent 025b17f commit a1868a7

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

integration_tests/tests/test_sampling_pii.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ def test_sampling_pii_disabled(test_id: str, dbt_project: DbtProject):
5353

5454

5555
@pytest.mark.skip_targets(["clickhouse"])
56-
def test_sampling_pii_disabled_with_default_config(
56+
def test_sampling_pii_disabled_with_default_config_and_casing(
5757
test_id: str, dbt_project: DbtProject
5858
):
59-
"""Test that PII-tagged tables don't upload samples even when tests fail"""
6059
null_count = 50
6160
data = [{COLUMN_NAME: None} for _ in range(null_count)]
6261

@@ -66,7 +65,7 @@ def test_sampling_pii_disabled_with_default_config(
6665
dict(column_name=COLUMN_NAME),
6766
data=data,
6867
as_model=True,
69-
model_config={"config": {"tags": ["pii"]}},
68+
model_config={"config": {"tags": ["pIi"]}},
7069
test_vars={
7170
"enable_elementary_test_materialization": True,
7271
"test_sample_row_count": TEST_SAMPLE_ROW_COUNT,

macros/edr/system/system_utils/is_pii_table.sql

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
{% do return(false) %}
55
{% endif %}
66

7-
{% set pii_tags = elementary.get_config_var('pii_tags') %}
8-
{% set model_tags = elementary.insensitive_get_dict_value(flattened_test, 'model_tags', []) %}
7+
{% set raw_pii_tags = elementary.get_config_var('pii_tags') %}
8+
{% set pii_tags = (raw_pii_tags if raw_pii_tags is iterable else [raw_pii_tags]) | map('lower') | list %}
9+
10+
{% set raw_model_tags = elementary.insensitive_get_dict_value(flattened_test, 'model_tags', []) %}
11+
{% set model_tags = (raw_model_tags if raw_model_tags is iterable else [raw_model_tags]) | map('lower') | list %}
912

1013
{% set intersection = elementary.lists_intersection(model_tags, pii_tags) %}
1114
{% set is_pii = intersection | length > 0 %}

0 commit comments

Comments
 (0)