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

Support RECORD #59

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@
"level": "restricted",
},
},
},
"dummy_record": {
"data_type": "RECORD",
"meta": {
"data_privacy": {
"level": "internal",
},
},
}
},
where="1 = 1",
Expand Down Expand Up @@ -141,6 +149,7 @@ WITH privacy_protected_model AS (
) AS `consents`,
dummy_column AS `dummy_column`,
dummy_array AS `dummy_array`,
dummy_record AS `dummy_record`,
FROM
{{ ref('test_restricted_users') }} AS __original_table
WHERE
Expand Down
2 changes: 1 addition & 1 deletion macros/pseudonymization/sha256.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{%- macro bigquery__sha256(expression, data_type=none) -%}
{% set secured_expression = "SHA256(CAST({} AS STRING))".format(expression)%}

{% if data_type | upper == "ARRAY" %}
{% if data_type | upper in ["ARRAY", "RECORD"] %}
{% set secured_expression = "ARRAY(SELECT SHA256(CAST(e AS STRING)) FROM UNNEST({}) AS e)".format(expression)%}
{% endif %}

Expand Down
2 changes: 1 addition & 1 deletion macros/pseudonymization/sha512.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{%- macro bigquery__sha512(expression, data_type=none) -%}
{% set secured_expression = "SHA512(CAST({} AS STRING))".format(expression)%}

{% if data_type | upper == "ARRAY" %}
{% if data_type | upper in ["ARRAY", "RECORD"] %}
{% set secured_expression = "ARRAY(SELECT SHA512(CAST(e AS STRING)) FROM UNNEST({}) AS e)".format(expression)%}
{% endif %}

Expand Down
2 changes: 1 addition & 1 deletion macros/pseudonymization/udf_hash.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{%- macro bigquery__udf_hash(expression, udf_function, data_type=none) -%}
{% set secured_expression = "{}(CAST({} AS STRING))".format(udf_function, expression)%}

{% if data_type | upper == "ARRAY" %}
{% if data_type | upper in ["ARRAY", "RECORD"] %}
{% set secured_expression = "ARRAY(SELECT {}(CAST(e AS STRING)) FROM UNNEST({}) AS e)".format(udf_function, expression)%}
{% endif %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{% set is_array = false %}
{% if restructured_column.original_info is defined
and restructured_column.original_info.data_type is defined
and restructured_column.original_info.data_type == "ARRAY" %}
and restructured_column.original_info.data_type in ["ARRAY", "RECORD"] %}
{% set is_array = true %}
{% endif %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{% set is_array = false %}
{% if restructured_column.original_info is defined
and restructured_column.original_info.data_type is defined
and restructured_column.original_info.data_type == "ARRAY" %}
and restructured_column.original_info.data_type in ["ARRAY", "RECORD"] %}
{% set is_array = true %}
{% endif %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{% if restructured_column.original_info is defined
and restructured_column.original_info is mapping
and restructured_column.original_info.data_type is defined
and restructured_column.original_info.data_type == "ARRAY" %}
and restructured_column.original_info.data_type in ["ARRAY", "RECORD"] %}
{% set is_array = true %}
{% endif %}

Expand Down