Skip to content

Commit

Permalink
feat: sync node to yaml instead of co-manipulation, decouples mutations
Browse files Browse the repository at this point in the history
chore: only use get node yaml if needed otherwise stick to node itself
  • Loading branch information
z3z1ma committed Jan 1, 2025
1 parent 6a786d3 commit a2b7afc
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 119 deletions.
62 changes: 23 additions & 39 deletions demo_duckdb/models/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,39 @@ models:

- 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: customer_lifetime_value
data_type: DOUBLE
description: ''

- name: customer_average_value
description: ''
data_type: DECIMAL(18,3)
- name: orders_prefix
columns:
- name: o_order_id
data_type: INTEGER
- name: o_customer_id
data_type: INTEGER
- name: o_order_date
data_type: DATE
- name: o_status
description: '{{ doc("orders_status") }}'
data_type: VARCHAR
- name: o_credit_card_amount
data_type: DOUBLE
- name: o_coupon_amount
data_type: DOUBLE
- name: o_bank_transfer_amount
data_type: DOUBLE
- name: o_gift_card_amount
data_type: DOUBLE
- name: o_amount
data_type: DOUBLE
- name: orders
description: This table has basic information about orders, as well as some derived facts based on payments

Expand All @@ -41,7 +54,6 @@ models:
- unique
- not_null
description: This is a unique identifier for an order

- name: customer_id
description: Foreign key to the customers table
tests:
Expand All @@ -52,7 +64,6 @@ models:

- name: order_date
description: Date (UTC) that the order was placed

- name: status
tests:
- accepted_values:
Expand Down Expand Up @@ -82,32 +93,5 @@ models:
description: Total amount (AUD) of the order
tests:
- not_null
- name: orders_prefix
columns:
- name: o_order_id
description: ''
data_type: INTEGER
- name: o_customer_id
description: ''
data_type: INTEGER
- name: o_order_date
description: ''
data_type: DATE
- name: o_status
description: '{{ doc("orders_status") }}'
data_type: VARCHAR
- name: o_credit_card_amount
description: ''
data_type: DOUBLE
- name: o_coupon_amount
description: ''
data_type: DOUBLE
- name: o_bank_transfer_amount
description: ''
data_type: DOUBLE
- name: o_gift_card_amount
description: ''
data_type: DOUBLE
- name: o_amount
description: ''
data_type: DOUBLE
sources: []
seeds: []
41 changes: 18 additions & 23 deletions demo_duckdb/models/staging/schema.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
version: 2

models:
- name: stg_customers
columns:
Expand All @@ -11,45 +10,41 @@ models:
data_type: INTEGER
- name: first_name
data_type: VARCHAR
description: ''
- name: last_name
data_type: VARCHAR
description: ''
- name: stg_orders
- name: stg_payments
columns:
- name: order_id
- name: payment_id
tests:
- unique
- not_null
data_type: INTEGER
- name: customer_id
- name: order_id
data_type: INTEGER
description: ''
- name: order_date
data_type: DATE
description: ''
- name: status
- name: payment_method
tests:
- accepted_values:
values: ['placed', 'shipped', 'completed', 'return_pending', 'returned']

values: ['credit_card', 'coupon', 'bank_transfer', 'gift_card']
data_type: VARCHAR
description: '{{ doc("orders_status") }}'
- name: stg_payments
- name: amount
data_type: DOUBLE
- name: stg_orders
columns:
- name: payment_id
- name: order_id
tests:
- unique
- not_null
data_type: INTEGER
- name: order_id
- name: customer_id
data_type: INTEGER
description: ''
- name: payment_method
- name: order_date
data_type: DATE
- name: status
tests:
- accepted_values:
values: ['credit_card', 'coupon', 'bank_transfer', 'gift_card']
values: ['placed', 'shipped', 'completed', 'return_pending', 'returned']

data_type: VARCHAR
- name: amount
data_type: DOUBLE
description: ''
description: '{{ doc("orders_status") }}'
sources: []
seeds: []
30 changes: 11 additions & 19 deletions demo_duckdb/seeds/schema.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@
version: 2
models: []
sources: []
seeds:
- name: raw_customers
columns:
- name: id
data_type: INTEGER
- name: first_name
data_type: VARCHAR
- name: last_name
data_type: VARCHAR
- name: raw_orders
columns:
- name: id
description: ''
data_type: INTEGER
- name: user_id
description: ''
data_type: INTEGER
- name: order_date
description: ''
data_type: DATE
- name: status
description: '{{ doc("orders_status") }}' # putting this in to test if unrendered propogation works
description: '{{ doc("orders_status") }}'
- name: raw_payments
columns:
- name: id
description: ''
data_type: INTEGER
- name: order_id
description: ''
data_type: INTEGER
- name: payment_method
description: ''
data_type: VARCHAR
- name: amount
description: ''
data_type: INTEGER
- name: raw_customers
columns:
- name: id
description: ''
data_type: INTEGER
- name: first_name
description: ''
data_type: VARCHAR
- name: last_name
description: ''
data_type: VARCHAR
Loading

0 comments on commit a2b7afc

Please sign in to comment.