
SQLMesh
Use a SQLMesh development plan and blocking audit to catch a duplicate billing join before promotion.
- Candidate join
- One subscription matches two account rows.
- Blocking audit
- The duplicate key halts the development plan.
- Repair and verify
- Rerun the audited intervals and compare totals by key.
A new SQLMesh model change joins billing subscriptions to a CRM account map. Two active mapping rows for the same key can double reported recurring revenue. Use a development plan and a blocking audit to catch the duplicated grain before promotion.
Audit the new model on the intervals you change
Build a plan for an isolated development environment. Attach an audit that returns any duplicated subscription-day key or another invalid row. By default, a failed blocking audit halts plan application. For incremental-by-time-range models, SQLMesh audits cover the intervals being processed. If your change must repair an older month, include that month explicitly and compare its output.
In the example, a $6,000 annual subscription is joined to two accounts through a faulty mapping. The candidate model returns two rows and the audit should fail. Repair the mapping or join rule, then rerun the plan and independently compare the aggregate totals. SQLMesh’s development plan checks are separate from the behavior of a scheduled run against production.
Test the blocked plan and the repaired output
| Test | Expected result | Evidence |
|---|---|---|
| Plan includes the duplicate mapping. | Blocking audit reports the repeated key and stops the plan. | Audit output and the offending interval. |
| Plan runs with the repaired map. | One subscription-day row and the correct recurring value. | Audit success and an independent keyed comparison. |
| Validate the earlier month. | Older data is checked deliberately before relying on it. | Use the relevant plan intervals or a separate historical audit query. |
Record the model version, audit result and time range on the release. The release management guide describes how to pair platform validation with a business readback.