diff --git a/cookbook/resources/demo-database/dbt/models/staging/_schema.yml b/cookbook/resources/demo-database/dbt/models/staging/_schema.yml index 5e285f1..aba4c78 100644 --- a/cookbook/resources/demo-database/dbt/models/staging/_schema.yml +++ b/cookbook/resources/demo-database/dbt/models/staging/_schema.yml @@ -27,6 +27,10 @@ models: data_tests: - accepted_values: values: ['completed', 'pending', 'cancelled', 'shipped', 'processing', 'return_pending'] + - name: tax_amount + description: Estimated tax at 8% of order total + - name: gross_total + description: Order total + shipping + tax - discounts - name: stg_jaffle_shop__order_items description: Order line items with calculated line totals @@ -39,12 +43,14 @@ models: description: Quantity * unit price - name: stg_stripe__payments - description: Payment transactions with risk scoring + description: Payment transactions with risk scoring (test transactions excluded) columns: - name: payment_id data_tests: - unique - not_null + - name: currency + description: Payment currency (defaults to USD) - name: payment_status data_tests: - accepted_values: diff --git a/cookbook/resources/demo-database/dbt/models/staging/stg_jaffle_shop__orders.sql b/cookbook/resources/demo-database/dbt/models/staging/stg_jaffle_shop__orders.sql index 08b44b9..f2208b7 100644 --- a/cookbook/resources/demo-database/dbt/models/staging/stg_jaffle_shop__orders.sql +++ b/cookbook/resources/demo-database/dbt/models/staging/stg_jaffle_shop__orders.sql @@ -11,6 +11,11 @@ cleaned as ( coalesce(order_total, 0) as order_total, coalesce(shipping_cost, 0) as shipping_cost, coalesce(discount_amount, 0) as discount_amount, + round(coalesce(order_total, 0) * 0.08, 2) as tax_amount, + coalesce(order_total, 0) + + coalesce(shipping_cost, 0) + + round(coalesce(order_total, 0) * 0.08, 2) + - coalesce(discount_amount, 0) as gross_total, coupon_code, created_at, updated_at diff --git a/cookbook/resources/demo-database/dbt/models/staging/stg_stripe__payments.sql b/cookbook/resources/demo-database/dbt/models/staging/stg_stripe__payments.sql index 71626b8..392ddbd 100644 --- a/cookbook/resources/demo-database/dbt/models/staging/stg_stripe__payments.sql +++ b/cookbook/resources/demo-database/dbt/models/staging/stg_stripe__payments.sql @@ -8,6 +8,7 @@ cleaned as ( order_id, payment_method, amount as payment_amount, + 'USD' as currency, status as payment_status, created_at as payment_created_at, card_last_four, @@ -18,6 +19,7 @@ cleaned as ( from source where id is not null and amount > 0 + and billing_email not like '%@test.com' ) select * from cleaned