Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit bb49ab3

Browse files
committed
Create src_seed folder
1 parent 720f359 commit bb49ab3

10 files changed

Lines changed: 97 additions & 101 deletions

File tree

File renamed without changes.

jaffle_shop/models/staging/schema.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
version: 2
2+
3+
models:
4+
- name: stg_customers_pii
5+
access: public
6+
config:
7+
group: industry_operations
8+
meta:
9+
owner: luke.ralphs-davies@octoenergy.com
10+
sensitive: true
11+
description: |
12+
This model contains one row per customer, alongside their first and last time.
13+
columns:
14+
- name: customer_id
15+
tests:
16+
- unique
17+
- not_null
18+
- name: first_name
19+
meta:
20+
sensitive: true
21+
- name: last_name
22+
meta:
23+
sensitive: true
24+
25+
- name: stg_customers
26+
access: public
27+
config:
28+
group: industry_operations
29+
owner: luke.ralphs-davies@octoenergy.com
30+
description: |
31+
This model contains one row per customer, alongside their first and last time, which
32+
are hashed to protect personally identifiable information (PII).
33+
columns:
34+
- name: customer_id
35+
tests:
36+
- unique
37+
- not_null
38+
39+
- name: stg_orders
40+
access: public
41+
config:
42+
group: industry_operations
43+
owner: luke.ralphs-davies@octoenergy.com
44+
description: |
45+
This model contains one row per order made by a customer, alongside
46+
the order date and status.
47+
columns:
48+
- name: order_id
49+
tests:
50+
- unique
51+
- not_null
52+
- name: status
53+
tests:
54+
- accepted_values:
55+
values: ['placed', 'shipped', 'completed', 'return_pending', 'returned']
56+
57+
- name: stg_payments
58+
access: public
59+
config:
60+
group: industry_operations
61+
owner: luke.ralphs-davies@octoenergy.com
62+
description: |
63+
This model contains one row per payment associated with an order, alongside
64+
the payment method.
65+
columns:
66+
- name: payment_id
67+
tests:
68+
- unique
69+
- not_null
70+
- name: payment_method
71+
tests:
72+
- accepted_values:
73+
values: ['credit_card', 'coupon', 'bank_transfer', 'gift_card']
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SELECT
2+
{{ hash_sensitive_columns('stg_customers_pii') }}
3+
FROM {{ ref('stg_customers_pii') }}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
SELECT
2+
id AS customer_id
3+
, NULLIF(first_name, '') AS first_name
4+
, NULLIF(last_name, '') AS last_name
5+
6+
FROM {{ ref('raw_customers') }}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SELECT
2+
id AS order_id
3+
, user_id AS customer_id
4+
, order_date
5+
, NULLIF(status, '') AS status
6+
7+
FROM {{ ref('stg_orders') }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
SELECT
2+
id AS payment_id
3+
, order_id
4+
, NULLIF(payment_method, '') AS payment_method
5+
-- `amount` is currently stored in cents, so we convert it to dollars
6+
, amount / 100 AS amount
7+
8+
FROM source

jaffle_shop/models/staging/stg_customers.sql

Lines changed: 0 additions & 22 deletions
This file was deleted.

jaffle_shop/models/staging/stg_orders.sql

Lines changed: 0 additions & 23 deletions
This file was deleted.

jaffle_shop/models/staging/stg_payments.sql

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)