|
| 1 | +version: 2 |
| 2 | + |
| 3 | +models: |
| 4 | + - name: customers |
| 5 | + description: This table has basic information about a customer, as well as some derived facts based on a customer's orders |
| 6 | + |
| 7 | + columns: |
| 8 | + - name: customer_id |
| 9 | + description: This is a unique identifier for a customer |
| 10 | + tests: |
| 11 | + - unique |
| 12 | + - not_null |
| 13 | + |
| 14 | + - name: first_name |
| 15 | + description: Customer's first name. PII. |
| 16 | + |
| 17 | + - name: last_name |
| 18 | + description: Customer's last name. PII. |
| 19 | + |
| 20 | + - name: first_order |
| 21 | + description: Date (UTC) of a customer's first order |
| 22 | + |
| 23 | + - name: most_recent_order |
| 24 | + description: Date (UTC) of a customer's most recent order |
| 25 | + |
| 26 | + - name: number_of_orders |
| 27 | + description: Count of the number of orders a customer has placed |
| 28 | + |
| 29 | + - name: total_order_amount |
| 30 | + description: Total value (AUD) of a customer's orders |
| 31 | + |
| 32 | + - name: orders |
| 33 | + description: This table has basic information about orders, as well as some derived facts based on payments |
| 34 | + |
| 35 | + columns: |
| 36 | + - name: order_id |
| 37 | + tests: |
| 38 | + - unique |
| 39 | + - not_null |
| 40 | + description: This is a unique identifier for an order |
| 41 | + |
| 42 | + - name: customer_id |
| 43 | + description: Foreign key to the customers table |
| 44 | + tests: |
| 45 | + - not_null |
| 46 | + - relationships: |
| 47 | + to: ref('customers') |
| 48 | + field: customer_id |
| 49 | + |
| 50 | + - name: order_date |
| 51 | + description: Date (UTC) that the order was placed |
| 52 | + |
| 53 | + - name: status |
| 54 | + description: '{{ doc("orders_status") }}' |
| 55 | + tests: |
| 56 | + - accepted_values: |
| 57 | + values: ['placed', 'shipped', 'completed', 'return_pending', 'returned'] |
| 58 | + |
| 59 | + - name: amount |
| 60 | + description: Total amount (AUD) of the order |
| 61 | + tests: |
| 62 | + - not_null |
| 63 | + |
| 64 | + - name: credit_card_amount |
| 65 | + description: Amount of the order (AUD) paid for by credit card |
| 66 | + tests: |
| 67 | + - not_null |
| 68 | + |
| 69 | + - name: coupon_amount |
| 70 | + description: Amount of the order (AUD) paid for by coupon |
| 71 | + tests: |
| 72 | + - not_null |
| 73 | + |
| 74 | + - name: bank_transfer_amount |
| 75 | + description: Amount of the order (AUD) paid for by bank transfer |
| 76 | + tests: |
| 77 | + - not_null |
| 78 | + |
| 79 | + - name: gift_card_amount |
| 80 | + description: Amount of the order (AUD) paid for by gift card |
| 81 | + tests: |
| 82 | + - not_null |
0 commit comments