-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate dbt models by dbt-data-privacy
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
9796b03
commit 72d47be
Showing
9 changed files
with
319 additions
and
4 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
...is_layer/consents/data_analysis_layer__dbt_data_privacy_data_analysis_layer__consents.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
-- This was automatically generated by the `dbt-data-privacy` package. | ||
-- noqa: disable=all | ||
{{ | ||
config( | ||
materialized="view", | ||
database=var('data_analysis_layer'), | ||
schema="dbt_data_privacy_data_analysis_layer", | ||
alias="consents", | ||
grant_access_to=[ | ||
{ | ||
"project": var('restricted_layer'), | ||
"dataset": "dbt_data_privacy_restricted_layer", | ||
}, | ||
], | ||
tags=['data_analysis', 'dbt_data_privacy'], | ||
labels={ | ||
"modeled_by": "dbt", | ||
}, | ||
persist_docs={'relation': True, 'columns': True}, | ||
full_refresh=None, | ||
enabled=True | ||
) | ||
}} | ||
|
||
WITH privacy_protected_model AS ( | ||
SELECT | ||
SHA256(CAST(user_id AS STRING)) AS `user_id`, | ||
STRUCT( | ||
consent.data_analysis AS `data_analysis`, | ||
SHA256(CAST(consent.data_sharing AS STRING)) AS `data_sharing` | ||
) AS `consent`, | ||
ARRAY(SELECT SHA256(CAST(e AS STRING)) FROM UNNEST(dummy_array) AS e) AS `dummy_array`, | ||
FROM | ||
{{ ref('restricted_layer__dbt_data_privacy_restricted_layer__consents') }} AS __original_table | ||
WHERE | ||
consent.data_analysis IS TRUE | ||
) | ||
|
||
SELECT | ||
__source.*, | ||
FROM privacy_protected_model AS __source |
41 changes: 41 additions & 0 deletions
41
...tests/models/data_analysis_layer/dbt_data_privacy_data_analysis_layer/consents/schema.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
# This was automatically generated by the `dbt-data-privacy` package. | ||
version: 2 | ||
|
||
models: | ||
- name: data_analysis_layer__dbt_data_privacy_data_analysis_layer__consents | ||
description: |- | ||
This is the truth of single source of consent agreements. | ||
## NOTE | ||
- XXX | ||
- XXX | ||
tags: ['data_analysis', 'dbt_data_privacy'] | ||
meta: | ||
modeled_by: dbt | ||
columns: | ||
- name: consent.data_analysis | ||
description: |- | ||
Consent agree of data analysis | ||
meta: | ||
data_privacy: | ||
level: internal | ||
- name: consent.data_sharing | ||
description: |- | ||
Consent agree of data sharing | ||
meta: | ||
data_privacy: | ||
level: internal | ||
- name: dummy_array | ||
description: |- | ||
Test array | ||
meta: | ||
data_privacy: | ||
level: internal | ||
- name: user_id | ||
description: |- | ||
User ID | ||
meta: | ||
data_privacy: | ||
level: internal |
35 changes: 35 additions & 0 deletions
35
...analysis_layer/items/data_analysis_layer__dbt_data_privacy_data_analysis_layer__items.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
-- This was automatically generated by the `dbt-data-privacy` package. | ||
-- noqa: disable=all | ||
{{ | ||
config( | ||
materialized="view", | ||
database=var('data_analysis_layer'), | ||
schema="dbt_data_privacy_data_analysis_layer", | ||
alias="items", | ||
grant_access_to=[ | ||
{ | ||
"project": var('restricted_layer'), | ||
"dataset": "dbt_data_privacy_restricted_layer", | ||
}, | ||
], | ||
tags=['data_analysis', 'dbt_data_privacy'], | ||
labels={ | ||
"modeled_by": "dbt", | ||
}, | ||
persist_docs={'relation': True, 'columns': True}, | ||
full_refresh=None, | ||
enabled=True | ||
) | ||
}} | ||
|
||
WITH privacy_protected_model AS ( | ||
SELECT | ||
id AS `id`, | ||
name AS `name`, | ||
FROM | ||
{{ ref('restricted_layer__dbt_data_privacy_restricted_layer__items') }} AS __original_table | ||
) | ||
|
||
SELECT | ||
__source.*, | ||
FROM privacy_protected_model AS __source |
29 changes: 29 additions & 0 deletions
29
...on_tests/models/data_analysis_layer/dbt_data_privacy_data_analysis_layer/items/schema.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
# This was automatically generated by the `dbt-data-privacy` package. | ||
version: 2 | ||
|
||
models: | ||
- name: data_analysis_layer__dbt_data_privacy_data_analysis_layer__items | ||
description: |- | ||
Items' table | ||
## NOTE | ||
- XXX | ||
- XXX | ||
tags: ['data_analysis', 'dbt_data_privacy'] | ||
meta: | ||
modeled_by: dbt | ||
columns: | ||
- name: id | ||
description: |- | ||
Item ID | ||
meta: | ||
data_privacy: | ||
level: public | ||
- name: name | ||
description: |- | ||
Item name | ||
meta: | ||
data_privacy: | ||
level: public |
49 changes: 49 additions & 0 deletions
49
...alysis_layer/orders/data_analysis_layer__dbt_data_privacy_data_analysis_layer__orders.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
-- This was automatically generated by the `dbt-data-privacy` package. | ||
-- noqa: disable=all | ||
{{ | ||
config( | ||
materialized="view", | ||
database=var('data_analysis_layer'), | ||
schema="dbt_data_privacy_data_analysis_layer", | ||
alias="orders", | ||
grant_access_to=[ | ||
{ | ||
"project": var('restricted_layer'), | ||
"dataset": "dbt_data_privacy_restricted_layer", | ||
}, | ||
], | ||
partition_by={ | ||
"field": "created_at", | ||
"data_type": "timestamp", | ||
"granularity": "day", | ||
}, | ||
cluster_by=['id'], | ||
tags=['data_analysis', 'dbt_data_privacy'], | ||
labels={ | ||
"modeled_by": "dbt", | ||
}, | ||
persist_docs={'relation': True, 'columns': True}, | ||
full_refresh=None, | ||
enabled=True | ||
) | ||
}} | ||
|
||
WITH privacy_protected_model AS ( | ||
SELECT | ||
id AS `id`, | ||
SHA256(CAST(user_id AS STRING)) AS `user_id`, | ||
item_id AS `item_id`, | ||
created_at AS `created_at`, | ||
FROM | ||
{{ ref('restricted_layer__dbt_data_privacy_restricted_layer__orders') }} AS __original_table | ||
) | ||
, __relationships_0 AS ( | ||
SELECT * | ||
FROM {{ ref("data_analysis_layer__dbt_data_privacy_data_analysis_layer__users") }} AS __relationships_0 | ||
) | ||
|
||
SELECT | ||
__source.*, | ||
FROM privacy_protected_model AS __source | ||
JOIN __relationships_0 | ||
ON __source.user_id = __relationships_0.user_id |
43 changes: 43 additions & 0 deletions
43
...n_tests/models/data_analysis_layer/dbt_data_privacy_data_analysis_layer/orders/schema.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
# This was automatically generated by the `dbt-data-privacy` package. | ||
version: 2 | ||
|
||
models: | ||
- name: data_analysis_layer__dbt_data_privacy_data_analysis_layer__orders | ||
description: |- | ||
Orders' table | ||
## NOTE | ||
- XXX | ||
- XXX | ||
tags: ['data_analysis', 'dbt_data_privacy'] | ||
meta: | ||
modeled_by: dbt | ||
columns: | ||
- name: created_at | ||
description: |- | ||
Order timestamp | ||
meta: | ||
data_privacy: | ||
level: internal | ||
- name: id | ||
description: |- | ||
Order ID | ||
meta: | ||
data_privacy: | ||
level: internal | ||
- name: item_id | ||
description: |- | ||
Item ID | ||
meta: | ||
data_privacy: | ||
level: public | ||
- name: user_id | ||
description: |- | ||
User ID | ||
meta: | ||
data_privacy: | ||
level: internal | ||
data_tests: | ||
- {'relationships': {'to': 'ref("data_analysis_layer__dbt_data_privacy_data_analysis_layer__users")', 'field': 'user_id'}} |
44 changes: 44 additions & 0 deletions
44
...analysis_layer/users/data_analysis_layer__dbt_data_privacy_data_analysis_layer__users.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
-- This was automatically generated by the `dbt-data-privacy` package. | ||
-- noqa: disable=all | ||
{{ | ||
config( | ||
materialized="view", | ||
database=var('data_analysis_layer'), | ||
schema="dbt_data_privacy_data_analysis_layer", | ||
alias="users", | ||
grant_access_to=[ | ||
{ | ||
"project": var('restricted_layer'), | ||
"dataset": "dbt_data_privacy_restricted_layer", | ||
}, | ||
], | ||
tags=['data_analysis', 'dbt_data_privacy'], | ||
labels={ | ||
"modeled_by": "dbt", | ||
}, | ||
persist_docs={'relation': True, 'columns': True}, | ||
full_refresh=None, | ||
enabled=True | ||
) | ||
}} | ||
|
||
WITH privacy_protected_model AS ( | ||
SELECT | ||
id AS `id`, | ||
SHA256(CAST(user_id AS STRING)) AS `user_id`, | ||
SHA256(CAST(age AS STRING)) AS `age`, | ||
FROM | ||
{{ ref('restricted_layer__dbt_data_privacy_restricted_layer__users') }} AS __original_table | ||
) | ||
, __relationships_0 AS ( | ||
SELECT * | ||
FROM {{ ref("data_analysis_layer__dbt_data_privacy_data_analysis_layer__consents") }} AS __relationships_0 | ||
WHERE | ||
consent.data_analysis IS TRUE | ||
) | ||
|
||
SELECT | ||
__source.*, | ||
FROM privacy_protected_model AS __source | ||
JOIN __relationships_0 | ||
ON __source.user_id = __relationships_0.user_id |
37 changes: 37 additions & 0 deletions
37
...on_tests/models/data_analysis_layer/dbt_data_privacy_data_analysis_layer/users/schema.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
# This was automatically generated by the `dbt-data-privacy` package. | ||
version: 2 | ||
|
||
models: | ||
- name: data_analysis_layer__dbt_data_privacy_data_analysis_layer__users | ||
description: |- | ||
Users' table | ||
## NOTE | ||
- XXX | ||
- XXX | ||
tags: ['data_analysis', 'dbt_data_privacy'] | ||
meta: | ||
modeled_by: dbt | ||
columns: | ||
- name: age | ||
description: |- | ||
Age | ||
meta: | ||
data_privacy: | ||
level: internal | ||
- name: id | ||
description: |- | ||
Raw number | ||
meta: | ||
data_privacy: | ||
level: internal | ||
- name: user_id | ||
description: |- | ||
User ID | ||
meta: | ||
data_privacy: | ||
level: internal | ||
data_tests: | ||
- {'relationships': {'to': 'ref("data_analysis_layer__dbt_data_privacy_data_analysis_layer__consents")', 'field': 'user_id'}} |