Store SQLMesh Audit Failures for Later Consumption
Summary
Add an option to sqlmesh audit to store failed audit results in a table for later analysis and reporting.
Background
Similar features exist in other data tools:
Use Case
Storing failed audit results enables:
- Historical tracking of audit performance
- Integration with data catalogs and quality dashboards
- Detailed analysis of failure patterns
Example: Generating a data catalog with a "Quality" tab showing all audits and their results, similar to Great Expectations Cloud.
Proposed Solution
1. Create a new table for failed audits
SELECT * FROM audits.failed
Example output:
| project |
model |
audit_id |
audit_description |
query |
failed |
audited_at |
| Project A |
Model X |
audit_1 |
Initial audit |
SELECT * ... |
true |
2024-08-28 07:56:36.366-03 |
| Project B |
Model Y |
audit_2 |
... |
... |
false |
2024-08-28 07:56:36.366-03 |
| Project C |
Model Y |
audit_3 |
... |
... |
false |
2024-08-28 07:56:36.366-03 |
2. Store detailed failure information
For each failed audit, create a separate table with failure details:
SELECT * FROM audits.audit_1
Alternative: JSON Export
Consider exporting failed values as a JSON object for flexibility.
Implementation Details
Questions
- How long should failed audit data be retained?
- Is there a way to store any kind of audit failure in the same
assertion_table independent of the model and the audit query?
Store SQLMesh Audit Failures for Later Consumption
Summary
Add an option to
sqlmesh auditto store failed audit results in a table for later analysis and reporting.Background
Similar features exist in other data tools:
Use Case
Storing failed audit results enables:
Example: Generating a data catalog with a "Quality" tab showing all audits and their results, similar to Great Expectations Cloud.
Proposed Solution
1. Create a new table for failed audits
Example output:
2. Store detailed failure information
For each failed audit, create a separate table with failure details:
Alternative: JSON Export
Consider exporting failed values as a JSON object for flexibility.
Implementation Details
sqlmesh audit(e.g.,--store-failures)audits.failedtableQuestions
assertion_tableindependent of the model and the audit query?