forked from dbt-labs/metricflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitest_simple.yaml
152 lines (152 loc) · 4.12 KB
/
itest_simple.yaml
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
---
integration_test:
name: simple_query
description: Tests selecting a metric and an associated local dimension.
model: SIMPLE_MODEL
metrics: ["booking_value"]
group_bys: ["is_instant"]
check_query: |
SELECT
SUM(booking_value) AS booking_value
, is_instant
FROM {{ source_schema }}.fct_bookings
GROUP BY
is_instant
---
integration_test:
name: simple_query_without_dates_available
description: Tests selecting a metric and the time dimension with a time constraint.
model: SIMPLE_MODEL
metrics: ["booking_value"]
group_bys: ["metric_time"]
time_constraint: ["1900-01-01", "1900-01-01"]
allow_empty: True
check_query: |
SELECT
SUM(booking_value) AS booking_value
, ds AS metric_time
FROM {{ source_schema }}.fct_bookings
GROUP BY
ds
limit 0
---
integration_test:
name: simple_query_with_time_constraint
description: Tests selecting a metric and the time dimension with a time constraint.
model: SIMPLE_MODEL
metrics: ["booking_value"]
group_bys: ["metric_time"]
time_constraint: ["2020-01-01", "2020-01-01"]
check_query: |
SELECT
SUM(booking_value) AS booking_value
, ds AS metric_time
FROM {{ source_schema }}.fct_bookings
WHERE {{ render_time_constraint("ds", "2020-01-01", "2020-01-01") }}
GROUP BY
ds
---
integration_test:
name: simple_query_with_joined_dimension_on_unique_id
description: Query a metric with a joined dimension where the join key is a unique identifier.
model: SIMPLE_MODEL
metrics: ["listings"]
group_bys: ["user__company_name"]
check_query: |
SELECT
SUM(1) AS listings
, b.company_name AS user__company_name
FROM {{ source_schema }}.dim_listings_latest a
LEFT OUTER JOIN {{ source_schema }}.dim_companies b
ON a.user_id = b.user_id
GROUP BY
2
---
integration_test:
name: simple_constrained_query
description: Tests simple constrained query.
model: SIMPLE_MODEL
metrics: ["booking_value"]
group_bys: ["is_instant"]
where_constraint: "is_instant"
check_query: |
SELECT
SUM(booking_value) AS booking_value
, is_instant
FROM {{ source_schema }}.fct_bookings
WHERE
is_instant
GROUP BY
is_instant
---
integration_test:
name: ordered_query
description: Tests an ordered query.
model: SIMPLE_MODEL
metrics: ["booking_value"]
group_bys: ["is_instant"]
check_query: |
SELECT
SUM(booking_value) AS booking_value
, is_instant
FROM {{ source_schema }}.fct_bookings
GROUP BY
is_instant
ORDER BY
booking_value DESC
---
integration_test:
name: query_with_multiple_metrics_ordered_by_metric
description: Tests query with multiple metrics ordered by metric.
model: SIMPLE_MODEL
required_features: ["FULL_OUTER_JOIN"]
metrics: ["bookings", "booking_value"]
group_bys: ["metric_time"]
order_bys: ["-booking_value"]
check_query: |
SELECT
SUM(1) AS bookings
, SUM(booking_value) AS booking_value
, ds AS metric_time
FROM {{ source_schema }}.fct_bookings
GROUP BY
ds
ORDER BY
booking_value DESC
---
integration_test:
name: query_with_multiple_metrics_ordered_by_dimension
description: Tests query with multiple metrics ordered by dimension.
model: SIMPLE_MODEL
required_features: ["FULL_OUTER_JOIN"]
metrics: ["bookings", "booking_value"]
group_bys: ["metric_time"]
order_bys: ["-metric_time"]
check_query: |
SELECT
SUM(1) AS bookings
, SUM(booking_value) AS booking_value
, ds AS metric_time
FROM {{ source_schema }}.fct_bookings
GROUP BY
ds
ORDER BY
booking_value DESC
---
integration_test:
name: query_with_join
description: Tests query with a join.
model: SIMPLE_MODEL
metrics: ["booking_value"]
group_bys: ["is_instant", "listing__country_latest"]
check_query: |
SELECT
SUM(b.booking_value) AS booking_value
, b.is_instant
, l.country AS listing__country_latest
FROM {{ source_schema }}.fct_bookings b
LEFT OUTER JOIN {{ source_schema }}.dim_listings_latest l
ON b.listing_id = l.listing_id
GROUP BY
b.is_instant
, l.country