Skip to content

Commit

Permalink
Add pii table and hashed data for stg_consumers table
Browse files Browse the repository at this point in the history
  • Loading branch information
elzette-van-rensburg committed Apr 3, 2024
1 parent 6d13fea commit ccf7f71
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 22 deletions.
36 changes: 36 additions & 0 deletions jaffle_shop/models/staging/src_seed/_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,45 @@ version: 2

models:
- name: stg_customers
meta:
owner: '[email protected]'
description:
Customer data with PII information hashed
columns:
- name: customer_id
tests:
- unique
- not_null
- name: first_name_hash
tests:
- dbt_expectations.expect_column_to_exist
- name: last_name_hash
tests:
- dbt_expectations.expect_column_to_exist

- name: stg_customers_pii
meta:
owner: '[email protected]'
sensitive: true
description:
Customer data with PII information exposed
columns:
- name: customer_id
tests:
- unique
- not_null
- name: first_name
meta:
sensitive: true
- name: last_name
meta:
sensitive: true

- name: stg_orders
meta:
owner: '[email protected]'
description:
All orders made by customers
columns:
- name: order_id
tests:
Expand All @@ -20,6 +52,10 @@ models:
values: ['placed', 'shipped', 'completed', 'return_pending', 'returned']

- name: stg_payments
meta:
owner: '[email protected]'
description:
All payments made by customers
columns:
- name: payment_id
tests:
Expand Down
25 changes: 3 additions & 22 deletions jaffle_shop/models/staging/src_seed/stg_customers.sql
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
with source as (

{#-
Normally we would select from the table here, but we are using seeds to load
our data in this project
#}
select * from {{ ref('raw_customers') }}

),

renamed as (

select
id as customer_id,
first_name,
last_name

from source

)

select * from renamed
SELECT
{{ hash_sensitive_columns ( 'stg_customers_pii' ) }}
FROM {{ ref('stg_customers_pii') }}
22 changes: 22 additions & 0 deletions jaffle_shop/models/staging/src_seed/stg_customers_pii.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
with source as (

{#-
Normally we would select from the table here, but we are using seeds to load
our data in this project
#}
select * from {{ ref('raw_customers') }}

),

renamed as (

select
id as customer_id,
first_name,
last_name

from source

)

select * from renamed

0 comments on commit ccf7f71

Please sign in to comment.