From 184324ce84f00dbe4cde31c751149ae3d0eb607a Mon Sep 17 00:00:00 2001 From: Alex Malins <22991362+alexmalins@users.noreply.github.com> Date: Wed, 7 Dec 2022 17:07:26 +0900 Subject: [PATCH] Put customers and orders tables into warehouse --- .../models/{overview.md => _overview.md} | 0 .../models/{docs.md => warehouse/_docs.md} | 0 .../models/{ => warehouse}/_models.yml | 28 ++++++------------- .../wh_customers.sql} | 4 +-- .../{orders.sql => warehouse/wh_orders.sql} | 0 .../dbt_project_evaluator_exceptions.csv | 2 ++ 6 files changed, 13 insertions(+), 21 deletions(-) rename jaffle_shop/models/{overview.md => _overview.md} (100%) rename jaffle_shop/models/{docs.md => warehouse/_docs.md} (100%) rename jaffle_shop/models/{ => warehouse}/_models.yml (88%) rename jaffle_shop/models/{customers.sql => warehouse/wh_customers.sql} (94%) rename jaffle_shop/models/{orders.sql => warehouse/wh_orders.sql} (100%) create mode 100644 jaffle_shop/seeds/dbt_project_evaluator_exceptions.csv diff --git a/jaffle_shop/models/overview.md b/jaffle_shop/models/_overview.md similarity index 100% rename from jaffle_shop/models/overview.md rename to jaffle_shop/models/_overview.md diff --git a/jaffle_shop/models/docs.md b/jaffle_shop/models/warehouse/_docs.md similarity index 100% rename from jaffle_shop/models/docs.md rename to jaffle_shop/models/warehouse/_docs.md diff --git a/jaffle_shop/models/_models.yml b/jaffle_shop/models/warehouse/_models.yml similarity index 88% rename from jaffle_shop/models/_models.yml rename to jaffle_shop/models/warehouse/_models.yml index 381349cfd..a7f41e0a8 100644 --- a/jaffle_shop/models/_models.yml +++ b/jaffle_shop/models/warehouse/_models.yml @@ -1,81 +1,71 @@ version: 2 models: - - name: customers + - name: wh_customers + meta: + owner: "alex.malins@octoenergy.com" + team_owner: '!subteam^S02GPV1135F' #@dbt_gatekeepers description: This table has basic information about a customer, as well as some derived facts based on a customer's orders - columns: - name: customer_id description: This is a unique identifier for a customer tests: - unique - not_null - - name: first_name description: Customer's first name. PII. - - name: last_name description: Customer's last name. PII. - - name: first_order description: Date (UTC) of a customer's first order - - name: most_recent_order description: Date (UTC) of a customer's most recent order - - name: number_of_orders description: Count of the number of orders a customer has placed - - name: total_order_amount description: Total value (AUD) of a customer's orders - - name: orders + - name: wh_orders + meta: + owner: "alex.malins@octoenergy.com" + team_owner: '!subteam^S02GPV1135F' #@dbt_gatekeepers description: This table has basic information about orders, as well as some derived facts based on payments - columns: - name: order_id tests: - unique - not_null description: This is a unique identifier for an order - - name: customer_id description: Foreign key to the customers table tests: - not_null - relationships: - to: ref('customers') + to: ref('wh_customers') field: customer_id - - name: order_date description: Date (UTC) that the order was placed - - name: status description: '{{ doc("orders_status") }}' tests: - accepted_values: values: ['placed', 'shipped', 'completed', 'return_pending', 'returned'] - - name: amount description: Total amount (AUD) of the order tests: - not_null - - name: credit_card_amount description: Amount of the order (AUD) paid for by credit card tests: - not_null - - name: coupon_amount description: Amount of the order (AUD) paid for by coupon tests: - not_null - - name: bank_transfer_amount description: Amount of the order (AUD) paid for by bank transfer tests: - not_null - - name: gift_card_amount description: Amount of the order (AUD) paid for by gift card tests: diff --git a/jaffle_shop/models/customers.sql b/jaffle_shop/models/warehouse/wh_customers.sql similarity index 94% rename from jaffle_shop/models/customers.sql rename to jaffle_shop/models/warehouse/wh_customers.sql index 016a004fe..dd7c60ef4 100644 --- a/jaffle_shop/models/customers.sql +++ b/jaffle_shop/models/warehouse/wh_customers.sql @@ -49,8 +49,8 @@ final as ( select customers.customer_id, - customers.first_name, - customers.last_name, + customers.first_name_hash, + customers.last_name_hash, customer_orders.first_order, customer_orders.most_recent_order, customer_orders.number_of_orders, diff --git a/jaffle_shop/models/orders.sql b/jaffle_shop/models/warehouse/wh_orders.sql similarity index 100% rename from jaffle_shop/models/orders.sql rename to jaffle_shop/models/warehouse/wh_orders.sql diff --git a/jaffle_shop/seeds/dbt_project_evaluator_exceptions.csv b/jaffle_shop/seeds/dbt_project_evaluator_exceptions.csv new file mode 100644 index 000000000..7c69f74e4 --- /dev/null +++ b/jaffle_shop/seeds/dbt_project_evaluator_exceptions.csv @@ -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. \ No newline at end of file