Skip to content

Commit

Permalink
Fix repo
Browse files Browse the repository at this point in the history
  • Loading branch information
WillC3 committed Apr 11, 2024
1 parent 720f359 commit fd3a7ad
Show file tree
Hide file tree
Showing 15 changed files with 716 additions and 453 deletions.
1,068 changes: 628 additions & 440 deletions Pipfile.lock

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions jaffle_shop/models/final/finance/_models.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2

exposures:
- name: fnl_finance_orders_per_customer
description: Used in Inksacio app
type: application
url: https://inksacio.eks.octopus.engineering/my_certification_dashboard/
owner:
email: [email protected]
depends_on:
- ref('wh_customers')

models:
- name: fnl_finance_orders_per_customer
description: This table contains the total value of orders per customer
columns:
- name: customer_id
description: This is a unique identifier for a customer
tests:
- unique
- not_null
- name: customer_lifetime_value
description: This is the total value of orders for a customer
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SELECT
customers.customer_id
, customers.customer_lifetime_value
FROM {{ ref('wh_customers') }} AS customers
23 changes: 23 additions & 0 deletions jaffle_shop/models/final/sales/_models.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2

exposures:
- name: fnl_sales_newcustomers
description: Used in Inksacio app
type: application
url: https://inksacio.eks.octopus.engineering/my_certification_dashboard/
owner:
email: [email protected]
depends_on:
- ref('wh_customers')

models:
- name: fnl_sales_newcustomers
description: This table contains the number of new customers per month
columns:
- name: month_start_date
description: This is a date representing the start of a month
tests:
- unique
- not_null
- name: new_customer_count
description: This is the number of new customers in a given month
6 changes: 6 additions & 0 deletions jaffle_shop/models/final/sales/fnl_sales_newcustomers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SELECT
DATE_TRUNC('MONTH', customers.first_order) AS month_start_date
, COUNT(customers.customer_id) AS new_customer_count
FROM {{ ref('wh_customers') }} AS customers
GROUP BY DATE_TRUNC('MONTH', customers.first_order)
ORDER BY DATE_TRUNC('MONTH', customers.first_order) DESC
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
version: 2

models:
- name: stg_customers_pii
columns:
- name: customer_id
tests:
- unique
- not_null
- name: first_name
meta:
sensitive: true
- name: last_name
meta:
sensitive: true
- name: stg_customers
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_orders
columns:
Expand Down
4 changes: 4 additions & 0 deletions jaffle_shop/models/staging/src_seed/stg_customers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SELECT
{{ hash_sensitive_columns('stg_customers_pii') }}
FROM {{ ref('stg_customers_pii') }}

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
version: 2

models:
- name: customers
description: This table has basic information about a customer, as well as some derived facts based on a customer's orders

- name: wh_customers
description: This table has basic information about a customer, as well as some derived facts based on a customer's orders.
columns:
- name: customer_id
description: This is a unique identifier for a customer
tests:
- unique
- not_null

- name: first_name
description: Customer's first name. PII.

- name: last_name
description: Customer's last name. PII.

- name: first_name_hash
description: Customer's first name.
- name: last_name_hash
description: Customer's last name.
- name: first_order
description: Date (UTC) of a customer's first order

- name: most_recent_order
description: Date (UTC) of a customer's most recent order

Expand All @@ -29,7 +25,7 @@ models:
- name: total_order_amount
description: Total value (AUD) of a customer's orders

- name: orders
- name: wh_orders
description: This table has basic information about orders, as well as some derived facts based on payments

columns:
Expand All @@ -44,7 +40,7 @@ models:
tests:
- not_null
- relationships:
to: ref('customers')
to: ref('stg_customers')
field: customer_id

- name: order_date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ customer_orders as (

select
customer_id,

min(order_date) as first_order,
max(order_date) as most_recent_order,
count(order_id) as number_of_orders
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions jaffle_shop/seeds/dbt_project_evaluator_exceptions.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fct_name,column_name,id_to_exclude,comment
fct_staging_dependent_on_staging,parent,stg_customers_pii,Scrubbing pii permitted in staging layer.

0 comments on commit fd3a7ad

Please sign in to comment.