Skip to content

Commit

Permalink
jsonify the embedded data_tests (#78)
Browse files Browse the repository at this point in the history
Signed-off-by: Yu Ishikawa <[email protected]>
  • Loading branch information
yu-iskw authored Aug 7, 2024
1 parent 7190ccf commit b421d7e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@
"policy_tags": ["unique_identifier"],
"test_project__test_dataset__test_table": {
"tests": [
"not_null"
{
"not_null": {
"config": {
"where": "1 = 1"
}
}
}
],
},
},
Expand Down Expand Up @@ -123,7 +129,7 @@ models:
data_privacy:
level: internal
data_tests:
- not_null
- {"not_null": {"config": {"where": "1=1"}}}
{%- endraw -%}
{%- endset %}

Expand Down
5 changes: 5 additions & 0 deletions macros/codegen/generate_secured_model_schema_v2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ models:
{%- set data_tests = column.meta.data_privacy[name].get('data_tests', [])
+ column.meta.data_privacy[name].get('tests', []) %}
data_tests: {%- for data_test in data_tests %}
{%- if data_test is mapping %}
{#- Convert to single line as we assume embedded JSON is ok in YAML #}
- {{ data_test | tojson }}
{%- else %}
- {{ data_test }}
{%- endif %}
{%- endfor %}
{%- endif %}
{%- endfor %}
Expand Down

0 comments on commit b421d7e

Please sign in to comment.