Skip to content

Commit

Permalink
Add fnl finanace and sales models
Browse files Browse the repository at this point in the history
  • Loading branch information
elzette-van-rensburg committed Apr 3, 2024
1 parent 98faa16 commit 142d157
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 0 deletions.
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
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.

0 comments on commit 142d157

Please sign in to comment.