Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gatekeeper Submission #30

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 0 additions & 69 deletions jaffle_shop/models/customers.sql

This file was deleted.

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

models:
- name: fnl_finance_order_returns
config:
tags: [access:public]
meta:
owner: '[email protected]'
team_owner: '[email protected]'
description: Table containing the value of all returned orders, per customer.
columns:
- name: customer_id
description: Primary key of the table
tests:
- unique
- not_null
6 changes: 6 additions & 0 deletions jaffle_shop/models/finance/fnl_finance_order_returns.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SELECT
customer_id
, SUM(amount) AS total_value_returned_per_customer
FROM {{ ref('wh_orders') }}
WHERE status = 'returned'
GROUP BY customer_id
56 changes: 0 additions & 56 deletions jaffle_shop/models/orders.sql

This file was deleted.

15 changes: 15 additions & 0 deletions jaffle_shop/models/sales/_exposures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

################################################################################
# EXPOSURES https://docs.getdbt.com/reference/exposure-properties
################################################################################

exposures:
- name: fnl_new_customer_sales
description: Inksacio dashboard
type: dashboard
url: https://inksacio.eks.octopus.engineering/my_certification_dashboard/
owner:
email: '[email protected]'
depends_on:
- ref('fnl_new_customer_sales')
16 changes: 16 additions & 0 deletions jaffle_shop/models/sales/_models.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2

models:
- name: fnl_new_customer_sales
config:
tags: [access:public]
meta:
owner: '[email protected]'
team_owner: '[email protected]'
description: Table on the number of customers who have made their first orders per month.
columns:
- name: first_order_month
description: Primary key of the table
tests:
- unique
- not_null
6 changes: 6 additions & 0 deletions jaffle_shop/models/sales/fnl_new_customer_sales.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SELECT
DATE_TRUNC('month', first_order) AS first_order_month
, COUNT(customer_id) AS customer_count
FROM {{ ref('wh_customers') }}
WHERE number_of_orders = 1 -- Only count customers with their first order
GROUP BY DATE_TRUNC('month', first_order)
76 changes: 76 additions & 0 deletions jaffle_shop/models/src_seed/_models.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
version: 2

models:
- name: stg_customers_pii
access: private
config:
group: example_group
meta:
owner: '[email protected]'
team_owner: '[email protected]'
sensitive: true
description: Table containing customer name information with PII included.
columns:
- name: customer_id
tests:
- unique
- not_null
- name: first_name
meta:
sensitive: true
- name: last_name
meta:
sensitive: true
- name: stg_customers
access: private
config:
group: example_group
meta:
owner: '[email protected]'
team_owner: '[email protected]'
description: Table containing customer name information with PII 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_orders
access: private
config:
group: example_group
meta:
owner: '[email protected]'
team_owner: '[email protected]'
description: Table containing customer orders.
columns:
- name: order_id
tests:
- unique
- not_null
- name: status
tests:
- accepted_values:
values: ['placed', 'shipped', 'completed', 'return_pending', 'returned']
- name: stg_payments
access: private
config:
group: example_group
meta:
owner: '[email protected]'
team_owner: '[email protected]'
description: Table containing customer payments.
columns:
- name: payment_id
tests:
- unique
- not_null
- name: payment_method
tests:
- accepted_values:
values: ['credit_card', 'coupon', 'bank_transfer', 'gift_card']
3 changes: 3 additions & 0 deletions jaffle_shop/models/src_seed/stg_customers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SELECT
{{ hash_sensitive_columns('stg_customers_pii') }}
FROM {{ ref('stg_customers_pii') }}
5 changes: 5 additions & 0 deletions jaffle_shop/models/src_seed/stg_customers_pii.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SELECT
id AS customer_id
, first_name
, last_name
FROM {{ ref('raw_customers') }}
6 changes: 6 additions & 0 deletions jaffle_shop/models/src_seed/stg_orders.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SELECT
id AS order_id
, user_id AS customer_id
, order_date
, status
FROM {{ ref('raw_orders') }}
6 changes: 6 additions & 0 deletions jaffle_shop/models/src_seed/stg_payments.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SELECT
id AS payment_id
, order_id
, payment_method
, amount / 100 AS amount
FROM {{ ref('raw_payments') }}
31 changes: 0 additions & 31 deletions jaffle_shop/models/staging/schema.yml

This file was deleted.

22 changes: 0 additions & 22 deletions jaffle_shop/models/staging/stg_customers.sql

This file was deleted.

23 changes: 0 additions & 23 deletions jaffle_shop/models/staging/stg_orders.sql

This file was deleted.

25 changes: 0 additions & 25 deletions jaffle_shop/models/staging/stg_payments.sql

This file was deleted.

Loading