-
Notifications
You must be signed in to change notification settings - Fork 633
Expand file tree
/
Copy pathschema.yml
More file actions
285 lines (259 loc) · 8.35 KB
/
Copy pathschema.yml
File metadata and controls
285 lines (259 loc) · 8.35 KB
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
version: 2
seeds:
- name: data_test_not_constant
columns:
- name: field
data_tests:
- dbt_utils.not_constant
- dbt_utils.not_constant:
group_by_columns: ['col_a']
- name: data_test_at_least_one
columns:
- name: field
data_tests:
- dbt_utils.at_least_one
- name: value
data_tests:
- dbt_utils.at_least_one:
group_by_columns: ['field']
error_if: "<1"
warn_if: "<0"
- name: data_test_expression_is_true
data_tests:
- dbt_utils.expression_is_true:
expression: col_a + col_b = 1
- dbt_utils.expression_is_true:
expression: col_a = 0.5
config:
where: col_b = 0.5
columns:
- name: col_a
data_tests:
- dbt_utils.expression_is_true:
expression: + col_b = 1
- name: col_b
data_tests:
- dbt_utils.expression_is_true:
expression: = 0.5
config:
where: col_a = 0.5
- name: data_people
columns:
- name: is_active
data_tests:
- dbt_utils.cardinality_equality:
field: is_active
to: ref('data_people')
- name: data_test_not_accepted_values
columns:
- name: city
data_tests:
- dbt_utils.not_accepted_values:
values: ['Madrid', 'Berlin']
- name: data_test_relationships_where_table_2
columns:
- name: id
data_tests:
- dbt_utils.relationships_where:
to: ref('data_test_relationships_where_table_1')
field: id
from_condition: id <> 4
- name: data_test_mutually_exclusive_ranges_no_gaps
data_tests:
- dbt_utils.mutually_exclusive_ranges:
lower_bound_column: lower_bound
upper_bound_column: upper_bound
gaps: not_allowed
- name: data_test_mutually_exclusive_ranges_with_gaps
data_tests:
- dbt_utils.mutually_exclusive_ranges:
lower_bound_column: valid_from
upper_bound_column: coalesce(valid_to, '2099-01-01')
partition_by: subscription_id
gaps: allowed
- dbt_utils.mutually_exclusive_ranges:
lower_bound_column: valid_from
upper_bound_column: coalesce(valid_to, '2099-01-01')
partition_by: subscription_id
gaps: required
- name: data_test_mutually_exclusive_ranges_with_gaps_zero_length
data_tests:
- dbt_utils.mutually_exclusive_ranges:
lower_bound_column: valid_from
upper_bound_column: valid_to
partition_by: subscription_id
zero_length_range_allowed: true
- name: data_unique_combination_of_columns
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- month
- product
- name: data_cardinality_equality_a
columns:
- name: same_name
data_tests:
- dbt_utils.cardinality_equality:
to: ref('data_cardinality_equality_b')
field: same_name
- dbt_utils.cardinality_equality:
to: ref('data_cardinality_equality_b')
field: different_name
- name: data_test_accepted_range
columns:
- name: id
data_tests:
- dbt_utils.accepted_range:
min_value: -1
max_value: 11
inclusive: true
- dbt_utils.accepted_range:
min_value: -2
max_value: 11.1
inclusive: false
- dbt_utils.accepted_range:
min_value: 0
inclusive: true
where: "id <> -1"
- name: data_not_null_proportion
columns:
- name: point_5
data_tests:
- dbt_utils.not_null_proportion:
at_least: 0.5
at_most: 0.5
- dbt_utils.not_null_proportion:
at_least: 0
group_by_columns: ['point_9']
- name: point_9
data_tests:
- dbt_utils.not_null_proportion:
at_least: 0.9
- name: data_test_equality_a
data_tests:
- dbt_utils.equality:
compare_model: ref('data_test_equality_a')
- dbt_utils.equality:
compare_model: ref('data_test_equality_b')
error_if: "<1" #sneaky way to ensure that the test is returning failing rows
warn_if: "<0"
- dbt_utils.equality:
compare_model: ref('data_test_equality_b')
compare_columns:
- col_a
- col_b
- dbt_utils.equality:
compare_model: ref('data_test_equality_b')
exclude_columns:
- col_c
- name: data_test_equality_different_column_names_a
data_tests:
- dbt_utils.equality:
compare_model: ref('data_test_equality_different_column_names_b')
compare_columns:
- col_a
- [tbl_a_col_b, tbl_b_col_b]
- dbt_utils.equality:
compare_model: ref('data_test_equality_different_column_names_b')
compare_columns:
- col_a
- [tbl_a_col_float, tbl_b_col_float]
precision: 4
- dbt_utils.equality:
compare_model: ref('data_test_equality_different_column_names_b')
compare_columns:
- col_a
- [tbl_a_col_float, tbl_b_col_float]
precision: 8
error_if: "<1" #sneaky way to ensure that the test is returning failing rows
warn_if: "<0"
- name: data_test_equality_floats_a
data_tests:
# test precision only
- dbt_utils.equality:
compare_model: ref('data_test_equality_floats_b')
precision: 4
- dbt_utils.equality:
compare_model: ref('data_test_equality_floats_b')
precision: 8
error_if: "<1" #sneaky way to ensure that the test is returning failing rows
warn_if: "<0"
- name: data_test_equality_floats_columns_a
data_tests:
# Positive assertion tests
- dbt_utils.equality:
compare_model: ref('data_test_equality_floats_columns_b')
compare_columns:
- id
- float_number
precision: 4
- dbt_utils.equality:
compare_model: ref('data_test_equality_floats_columns_b')
exclude_columns:
- to_ignore
precision: 4
# all columns should fail even with rounding
- dbt_utils.equality:
compare_model: ref('data_test_equality_floats_columns_b')
precision: 4
error_if: "<1" #sneaky way to ensure that the test is returning failing rows
warn_if: "<0"
models:
- name: recency_time_included
data_tests:
- dbt_utils.recency:
datepart: day
field: created_at
interval: 1
- dbt_utils.recency:
datepart: day
field: created_at
interval: 1
group_by_columns: ['col1']
- dbt_utils.recency:
datepart: day
field: created_at
interval: 1
group_by_columns: ['col1', 'col2']
- name: recency_time_excluded
data_tests:
- dbt_utils.recency:
datepart: day
field: created_at
interval: 1
ignore_time_component: true
- dbt_utils.recency:
datepart: day
field: created_at
interval: 1
ignore_time_component: false
error_if: "<1" #sneaky way to ensure that the test is returning failing rows
warn_if: "<0"
- name: test_equal_rowcount
data_tests:
- dbt_utils.equal_rowcount:
compare_model: ref('test_equal_rowcount')
- dbt_utils.equal_rowcount:
compare_model: ref('test_equal_rowcount')
group_by_columns: ['field']
- name: test_equal_column_subset
data_tests:
- dbt_utils.equality:
compare_model: ref('data_people')
compare_columns:
- first_name
- last_name
- email
- name: test_fewer_rows_than
data_tests:
- dbt_utils.fewer_rows_than:
compare_model: ref('data_test_fewer_rows_than_table_2')
- dbt_utils.fewer_rows_than:
compare_model: ref('data_test_fewer_rows_than_table_2')
group_by_columns: ['col_a']
- name: equality_less_columns
data_tests:
- dbt_utils.equality:
compare_model: ref('data_test_equality_a')
exclude_columns:
- col_c