Skip to content

Commit

Permalink
Lineage Fixes
Browse files Browse the repository at this point in the history
remove unnecesary model


Add descriptions
  • Loading branch information
ElliotTaylor23 committed Jan 4, 2023
1 parent 74d472b commit cce8d12
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% set return_states = ['returned', 'return_pending'] %}

select
custs.customer_id
orders.customer_id

{% for return_state in return_states -%}
, SUM(payments.amount_dollars) FILTER (WHERE orders.status =' {{ return_state }}') AS {{ return_state }}_amount_dollars
Expand All @@ -10,9 +10,7 @@ select
, SUM(payments.amount_dollars) AS sum_return_amount_dollars

from {{ ref('wh_orders') }} AS orders
left join {{ ref('wh_customers') }} AS custs
on custs.customer_id = orders.customer_id
left join {{ ref('stg_payments') }} AS payments
on payments.order_id = orders.order_id
where orders.status IN ('returned', 'return_pending')
GROUP BY customer_id
GROUP BY orders.customer_id
13 changes: 13 additions & 0 deletions jaffle_shop/models/staging/src_seed/_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ version: 2

models:
- name: stg_orders
description: staging layer for all orders
columns:
- name: order_id
description: Primary Key
tests:
- unique
- not_null
Expand All @@ -14,11 +16,22 @@ models:

- name: stg_payments
columns:
description: staging layer for all payments with a FK to order
- name: payment_id
description: Primary Key
tests:
- unique
- not_null
- name: payment_method
tests:
- accepted_values:
values: ['credit_card', 'coupon', 'bank_transfer', 'gift_card']

- name: stg_customers
description: staging layer for all customers, PII hashed
columns:
- name: customer_id
description: Primary Key
tests:
- unique
- not_null
3 changes: 3 additions & 0 deletions jaffle_shop/models/staging/src_seed/sensitive/_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ version: 2

models:
- name: stg_customers_pii
description: >
Table that includes all info about all customers, with PII hashed
columns:
- name: customer_id
description: Primary Key
tests:
- unique
- not_null
Expand Down

0 comments on commit cce8d12

Please sign in to comment.