forked from datacoves/pre-commit-dbt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-hooks.yaml
290 lines (290 loc) · 10.6 KB
/
.pre-commit-hooks.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
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
286
287
288
289
290
- id: check-column-desc-are-same
name: Check column descriptions are same
description: Check the models have same descriptions for same column names.
entry: check-column-desc-are-same
language: python
files: '.*\.(yml|yaml)$'
- id: check-column-name-contract
name: Check column name contract
description: Check column name abides to contract.
entry: check-column-name-contract
language: python
types_or: [sql, yaml]
- id: check-macro-has-description
name: Check the macro has description
description: Ensures that the macro has description in properties file.
entry: check-macro-has-description
language: python
types_or: [yaml, sql]
require_serial: true # because we need to process yaml and sql
- id: check-macro-arguments-have-desc
name: Check the macro arguments have description
description: Ensures that the macro has arguments with descriptions in properties file.
entry: check-macro-arguments-have-desc
language: python
types_or: [yaml, sql]
require_serial: true # because we need to process yaml and sql
- id: check-model-columns-have-desc
name: Check the model columns have description
description: Ensures that the model has columns with descriptions in properties file.
entry: check-model-columns-have-desc
language: python
types_or: [yaml, sql]
require_serial: true # because we need to process yaml and sql
- id: check-model-has-all-columns
name: Check the model has all columns in properties file
description: Ensures that all columns in database are specified in properties file.
entry: check-model-has-all-columns
language: python
types_or: [sql, yaml]
- id: check-model-has-description
name: Check the model has description
description: Ensures that the model has description in properties file.
entry: check-model-has-description
language: python
types_or: [yaml, sql]
require_serial: true # because we need to process yaml and sql
- id: check-model-has-meta-keys
name: Check the model has keys in the meta part
description: Ensures that the model has a list of valid meta keys.
entry: check-model-has-meta-keys
language: python
types_or: [yaml, sql]
require_serial: true # because we need to process YAML and SQL
- id: check-model-has-properties-file
name: Check the model has properties file
description: Ensures that the model has properties file (schema file).
entry: check-model-has-properties-file
language: python
types_or: [sql, yaml]
- id: check-model-has-tests-by-group
name: Check the model has a number of tests from a group of tests.
description: Ensures that the model has a number of tests from a group of tests.
entry: check-model-has-tests-by-group
language: python
types_or: [sql, yaml]
- id: check-model-has-tests-by-name
name: Check the model tests by a test name
description: Ensures that the model has a number of tests of a certain name (e.g. data, unique).
entry: check-model-has-tests-by-name
language: python
types_or: [sql, yaml]
- id: check-model-has-tests-by-type
name: Check the model tests by a test type
description: Ensures that the model has a number of tests of a certain type (data, schema).
entry: check-model-has-tests-by-type
language: python
types_or: [sql, yaml]
- id: check-model-has-tests
name: Check the model has a tests
description: Ensures that the model has a number of tests.
entry: check-model-has-tests
language: python
types_or: [sql, yaml]
- id: check-model-name-contract
name: Check model name contract
description: Check model name abides to contract.
entry: check-model-name-contract
language: python
types_or: [sql]
- id: check-model-parents-schema
name: Check parent models or sources are from certain schema
entry: check-model-parents-schema
language: python
types_or: [yaml, sql]
- id: check-model-parents-and-childs
name: Check the model has a parents/childs
description: Ensures the model has a specific number (max/min) of parents or/and childs.
entry: check-model-parents-and-childs
language: python
types_or: [sql, yaml]
- id: check-model-tags
name: Check the model has valid tags
description: Ensures that the model has only valid tags from the provided list.
entry: check-model-tags
language: python
types_or: [sql, yaml]
- id: check-script-has-no-table-name
name: Check the script has not table name
description: Ensures that the script is using only source or ref macro to specify the table name.
entry: check-script-has-no-table-name
language: python
types_or: [sql]
- id: check-script-ref-and-source
name: Check the script has existing refs and sources
description: Ensures that the script contains only existing sources or macros.
entry: check-script-ref-and-source
language: python
types_or: [sql]
- id: check-script-semicolon
name: Check the script does not contain a semicolon
description: Ensure that the script does not have a semicolon at the end of the file.
entry: check-script-semicolon
language: python
types_or: [sql]
- id: check-script-pivot
name: Check the script does not contain the PIVOT function
description: Ensure that the script does not call the PIVOT function
entry: check-script-pivot
language: python
types_or: [sql]
- id: check-source-childs
name: Check the source has a specific number (max/min) of childs.
description: Ensures the source has a specific number (max/min) of childs.
entry: check-source-childs
language: python
types_or: [sql]
- id: check-source-columns-have-desc
name: Check for source column descriptions
description: Ensures that the source has columns with descriptions in the properties file.
entry: check-source-columns-have-desc
language: python
types_or: [yaml]
- id: check-source-has-all-columns
name: Check the source has all columns in the properties file
description: Ensures that all columns in the database are specified in the properties file.
entry: check-source-has-all-columns
language: python
types_or: [yaml]
- id: check-source-table-has-description
name: Check the source table has description
description: Ensures that the source table has description in properties file.
entry: check-source-table-has-description
language: python
types_or: [yaml]
- id: check-source-has-freshness
name: Check the source has the freshness
description: Ensures that the source has freshness options.
entry: check-source-has-freshness
language: python
types_or: [yaml]
- id: check-source-has-loader
name: Check the source has loader option
description: Ensures that the source has loader option.
entry: check-source-has-loader
language: python
types_or: [yaml]
- id: check-source-has-meta-keys
name: Check the source has keys in the meta part
description: Ensures that the source has a list of valid meta keys.
entry: check-source-has-meta-keys
language: python
types_or: [yaml]
- id: check-source-has-tests-by-name
name: Check the source tests by test name
description: Ensures that the source has a number of tests of a certain name (e.g. data, unique).
entry: check-source-has-tests-by-name
language: python
types_or: [yaml]
- id: check-source-has-tests-by-type
name: Check the source tests by test type
description: Ensures that the source has a number of tests of a certain type (data, schema).
entry: check-source-has-tests-by-type
language: python
types_or: [yaml]
- id: check-source-has-tests
name: Check the source has tests
description: Ensures that the source has a number of tests.
entry: check-source-has-tests
language: python
types_or: [yaml]
- id: check-source-tags
name: Check the source has valid tags
description: Ensures that the source has only valid tags from the provided list.
entry: check-source-tags
language: python
types_or: [yaml]
- id: dbt-clean
name: dbt clean
description: Deletes all folders specified in the clean-targets.
entry: dbt-clean
language: python
pass_filenames: false
- id: dbt-compile
name: dbt compile
description: Generates executable SQL from source model, test, and analysis files.
entry: dbt-compile
language: python
types_or: [sql]
require_serial: true
- id: dbt-deps
name: dbt deps
description: Pulls the most recent version of the dependencies listed in your packages.yml.
entry: dbt-deps
language: python
pass_filenames: false
- id: dbt-docs-generate
name: dbt docs generate
description: The command is responsible for generating your project's documentation website.
entry: dbt-docs-generate
language: python
pass_filenames: false
- id: dbt-run
name: dbt run
description: Executes compiled sql model files.
entry: dbt-run
language: python
require_serial: true
types_or: [sql]
- id: dbt-test
name: dbt test
description: Runs tests on data in deployed models.
entry: dbt-test
language: python
require_serial: true
types_or: [sql]
- id: generate-missing-sources
name: Generate missing sources
description: If any source is missing this hook tries to create it.
entry: generate-missing-sources
language: python
types_or: [sql]
- id: generate-model-properties-file
name: Generate model properties file
description: Generate model properties file if does not exists.
entry: generate-model-properties-file
language: python
types_or: [sql]
args:
[
"--properties-file",
"/Users/tomsejr/Documents/03-Workspace/Private/jaffle_shop/{database}/{schema}/{name}.yml",
]
require_serial: true
- id: unify-column-description
name: Unify column description
description: Unify column descriptions across all models
entry: unify-column-description
language: python
files: '.*\.(yml|yaml)$'
require_serial: true
- id: replace-script-table-names
name: Replace script table names
description: Replace table names with source or ref macros in the script.
entry: replace-script-table-names
language: python
types_or: [sql]
- id: remove-script-semicolon
name: Remove script semicolon
description: Remove semicolon at the end of the script.
entry: remove-script-semicolon
language: python
types_or: [sql]
- id: check-model-has-primary-key-tag
name: Check model has primary key tag
description: Check model has primary key tag for at least one column.
entry: check-model-has-primary-key-tag
language: python
types_or: [yaml, sql]
- id: check-model-has-primary-key-description
name: Check model has primary key description
description: Check model has description for all primary key columns.
entry: check-model-has-primary-key-description
language: python
types_or: [yaml, sql]
- id: check-snapshot-has-target-schema
name: Check the snapshot has a target_schema attached
description: Ensures that the model has only valid tags from the provided list.
entry: check-snapshot-has-target-schema
language: python
types_or: [sql, yaml]