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

Elzette dbt cert #25

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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
10 changes: 10 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/octo_jaffle_shop.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,068 changes: 628 additions & 440 deletions Pipfile.lock

Large diffs are not rendered by default.

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

exposures:
- name: fnl_finance_returns_by_customer
label: fnl_finance_returns_by_customer
description: Inksacio data app with dashboard for dbt certification
type: dashboard
url: https://inksacio.eks.octopus.engineering/my_certification_dashboard/
owner:
email: example.email@octoenergy.com
depends_on:
- ref('fnl_finance_returns_by_customer')
- name: fnl_sales_newcustomers
label: fnl_sales_newcustomers
description: Inksacio data app with dashboard for dbt certification
type: dashboard
url: https://inksacio.eks.octopus.engineering/my_certification_dashboard/
owner:
email: example.email@octoenergy.com
depends_on:
- ref('fnl_sales_newcustomers')
15 changes: 15 additions & 0 deletions jaffle_shop/models/final/finance/_models.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

models:
- name: fnl_finance_returns_by_customer
meta:
owner: 'example.email@octoenergy.com'
description:
Table with value of completed returns by customer
columns:
- name: customer_id
tests:
- unique
- not_null
- name: total_returned
description: Total value of completed returns made by customer, excluding pending returns
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SELECT
customer_id,
SUM(amount) AS total_returned
FROM {{ ref('wh_orders') }}
WHERE `status` = 'returned'
GROUP BY customer_id
13 changes: 13 additions & 0 deletions jaffle_shop/models/final/sales/_models.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2

models:
- name: fnl_sales_newcustomers
meta:
owner: 'example.email@octoenergy.com'
description:
The customer count by month for customers making their first order
columns:
- name: first_order_month
tests:
- unique
- not_null
5 changes: 5 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,5 @@
SELECT
DATE_TRUNC('month', first_order) AS first_order_month,
COUNT(DISTINCT customer_id) AS number_first_orders
FROM {{ ref('wh_customers') }}
GROUP BY first_order_month
31 changes: 0 additions & 31 deletions jaffle_shop/models/staging/schema.yml

This file was deleted.

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

models:
- name: stg_customers
meta:
owner: 'example.email@octoenergy.com'
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: 'example.email@octoenergy.com'
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: 'example.email@octoenergy.com'
description:
All orders made by customers
columns:
- name: order_id
tests:
- unique
- not_null
- name: status
tests:
- accepted_values:
values: ['placed', 'shipped', 'completed', 'return_pending', 'returned']

- name: stg_payments
meta:
owner: 'example.email@octoenergy.com'
description:
All payments made by customers
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/staging/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') }}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
version: 2

models:
- name: customers
- name: wh_customers
meta:
owner: 'example.email@octoenergy.com'
description: This table has basic information about a customer, as well as some derived facts based on a customer's orders

columns:
Expand All @@ -12,10 +14,10 @@ models:
- not_null

- name: first_name
description: Customer's first name. PII.
description: Customer's first name, hashed for privacy

- name: last_name
description: Customer's last name. PII.
description: Customer's last name, hashed for privacy

- name: first_order
description: Date (UTC) of a customer's first order
Expand All @@ -29,7 +31,9 @@ models:
- name: total_order_amount
description: Total value (AUD) of a customer's orders

- name: orders
- name: wh_orders
meta:
owner: 'example.email@octoenergy.com'
description: This table has basic information about orders, as well as some derived facts based on payments

columns:
Expand Down
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.
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# pytest.ini
[pytest]
addopts = "--ignore=dbt_packages"