You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e978b33
Browse filesBrowse the repository at this point in the historyBrowse files
Standalone audits are defined independently rather than being attached to a specific model. They specify the models they depend on using the `depends_on` property.
164
+
165
+
Unlike model-level audits, standalone audits can be used to validate data across one or more models without being associated with a single model.
166
+
167
+
Standalone audits run as scheduled nodes during both `sqlmesh plan` and `sqlmesh run`.
168
+
169
+
```sql linenums="1"
170
+
AUDIT (
171
+
name assert_item_price_is_not_null,
172
+
dialect spark,
173
+
standalone TRUE,
174
+
depends_on (
175
+
sushi.items
176
+
)
177
+
);
178
+
179
+
SELECT*
180
+
FROMsushi.items
181
+
WHERE
182
+
ds BETWEEN @start_ds AND @end_ds
183
+
AND price IS NULL;
184
+
```
185
+
186
+
In this example, the audit checks that the `price` column in `sushi.items` does not contain `NULL` values for the selected date range.
187
+
188
+
Standalone audits can declare dependencies using the `depends_on` property. SQLMesh can often infer dependencies directly from the audit query, but using `depends_on` is recommended when inference isn't sufficient.
189
+
190
+
!!! note
191
+
192
+
Standalone audits are non-blocking only. Because they are not associated with a single model, SQLMesh cannot determine which model should be blocked if the audit fails.
162
193
## Built-in audits
163
194
SQLMesh comes with a suite of built-in generic audits that cover a broad set of common use cases. Built-in audits are blocking by default, but they all have non-blocking counterparts which you can use by appending `_non_blocking` - see [Non-blocking audits](#non-blocking-audits).
0 commit comments