-
Notifications
You must be signed in to change notification settings - Fork 933
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
720f359
commit 90673ec
Showing
19 changed files
with
189 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"editor.tabSize": 2, | ||
"editor.detectIndentation": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: 2 | ||
|
||
################################################################################ | ||
# EXPOSURES https://docs.getdbt.com/reference/exposure-properties | ||
################################################################################ | ||
exposures: | ||
- name: fnl_finance_returned_orders | ||
description: Inksacio Dashboard | ||
type: dashboard | ||
url: url: https://inksacio.uk.octopus.engineering/my_certification_finance_dashboard/ | ||
owner: | ||
email: [email protected] | ||
depends_on: | ||
- ref('fnl_finance_returned_orders') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: fnl_finance_returned_orders | ||
config: | ||
tags: ['access:public'] | ||
meta: | ||
owner: '[email protected]' | ||
description: | | ||
Report on the value of returned orders. 1 row per customer with total returned value for | ||
that customer | ||
columns: | ||
- name: customer_id | ||
description: Primary key | ||
tests: | ||
- unique | ||
- not_null |
14 changes: 14 additions & 0 deletions
14
jaffle_shop/models/final/finance/fnl_finance_returned_orders.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
WITH returned_orders AS ( | ||
SELECT | ||
customer_id | ||
, amount AS value | ||
FROM {{ ref('wh_orders') }} | ||
WHERE status = 'returned' | ||
GROUP BY customer_id | ||
) | ||
|
||
SELECT | ||
customer_id | ||
, SUM(value) AS total_value | ||
FROM returned_orders | ||
GROUP BY customer_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: 2 | ||
|
||
################################################################################ | ||
# EXPOSURES https://docs.getdbt.com/reference/exposure-properties | ||
################################################################################ | ||
exposures: | ||
- name: fnl_sales_first_orders | ||
description: Inksacio Dashboard | ||
type: dashboard | ||
url: url: https://inksacio.uk.octopus.engineering/my_certification_sales_dashboard/ | ||
owner: | ||
email: [email protected] | ||
depends_on: | ||
- ref('fnl_sales_first_orders') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: fnl_sales_first_orders | ||
config: | ||
tags: ['access:public'] | ||
meta: | ||
owner: '[email protected]' | ||
description: | | ||
Report on the numbers of customers making their first order per month. | ||
columns: | ||
- name: first_order_month | ||
description: Primary key | ||
tests: | ||
- unique | ||
- not_null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
WITH customer_first_orders AS ( | ||
SELECT | ||
customer_id | ||
-- Get just the month from the first order date | ||
, DATE_FORMAT(first_order, 'MMMM') As first_order_month | ||
FROM {{ ref('wh_customers') }} | ||
) | ||
|
||
SELECT | ||
first_order_month | ||
, COUNT(*) AS number_of_customers | ||
FROM customer_first_orders | ||
GROUP BY first_order_month | ||
|
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: stg_customers_pii | ||
config: | ||
tags: ['access:private'] | ||
meta: | ||
owner: '[email protected]' | ||
description: | | ||
Staging table for csv containing customer information. | ||
columns: | ||
- name: customer_id | ||
tests: | ||
- unique | ||
- not_null | ||
- name: first_name | ||
meta: | ||
sensitive: true | ||
- name: last_name | ||
meta: | ||
sensitive: true | ||
- name: stg_customers | ||
config: | ||
tags: ['access:private'] | ||
meta: | ||
owner: '[email protected]' | ||
description: | | ||
Staging table for csv containing customer information with PII columns 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 | ||
columns: | ||
- name: order_id | ||
tests: | ||
- unique | ||
- not_null | ||
- name: status | ||
tests: | ||
- accepted_values: | ||
values: ['placed', 'shipped', 'completed', 'return_pending', 'returned'] | ||
|
||
- name: stg_payments | ||
columns: | ||
- name: payment_id | ||
tests: | ||
- unique | ||
- not_null | ||
- name: payment_method | ||
tests: | ||
- accepted_values: | ||
values: ['credit_card', 'coupon', 'bank_transfer', 'gift_card'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: 2 | ||
|
||
seeds: | ||
- name: raw_customers | ||
description: | | ||
Table containing customer_id, and their first and last name. | ||
config: | ||
column_types: | ||
id: int | ||
first_name: string | ||
last_name: string | ||
- name: raw_orders | ||
description: | | ||
Table containing information about customers orders | ||
config: | ||
column_types: | ||
id: int | ||
user_id: int | ||
order_date: date | ||
status: string | ||
- name: raw_payments | ||
description: | | ||
Table containing information about customers payments | ||
config: | ||
column_types: | ||
id: int | ||
order_id: int | ||
payment_method: string | ||
amount: int | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |