-
Notifications
You must be signed in to change notification settings - Fork 0
/
spree_commerce_template.model.lookml
83 lines (62 loc) · 2.28 KB
/
spree_commerce_template.model.lookml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
- connection: shop-smartthings-com
# - scoping: true # for backward compatibility
# - include: "spree_*.view.lookml" # include all raw views
# - include: "template_*.view.lookml"
# - include: "*.dashboard.lookml" # include all dashboards in this project
- explore: template_line_items
extension: required
label: 'Orders & Line Items'
conditionally_filter:
unless: [orders.date_fields*, line_items.date_fields*, orders_monthly_cohort.created_month, subsequent_order_facts.date_fields*]
always_filter:
# If users need to compare locked vs non-locked orders, set this to "is any value" in explore
orders.state: 'complete'
joins:
- join: orders
from: template_orders
foreign_key: order_id
- join: users
from: template_users
foreign_key: orders.user_id
- join: user_order_facts
from: template_user_order_facts
sql_on: ${orders.user_id} = ${user_order_facts.user_id}
relationship: many_to_one
- join: orders_monthly_cohort
from: template_orders_monthly_cohort
sql_on: ${orders_monthly_cohort.created_month} = ${user_order_facts.first_order_month}
relationship: many_to_one
- join: subsequent_order_facts
from: template_subsequent_order_facts
foreign_key: orders.id
relationship: many_to_one
- join: product_variants
from: template_product_variants
foreign_key: variant_id
- join: products
from: template_products
foreign_key: product_variants.product_id
- join: reimbursements
from: spree_reimbursements
sql_on: ${reimbursements.order_id} = ${orders.id}
relationship: many_to_one
# can join payment info here too
- explore: template_users
extension: required
joins:
- join: orders
from: template_orders
sql_on: ${orders.user_id} = ${users.id}
relationship: one_to_many
- join: user_order_facts
from: template_user_order_facts
foreign_key: id
relationship: one_to_one
- explore: template_products
extension: required
label: 'Product Catalog'
# - explore: template_user_product_affinity
# extension: required
# label: 'Product Affinity - by Users'
- explore: template_order_product_affinity
extension: required