sqlmesh icon indicating copy to clipboard operation
sqlmesh copied to clipboard

Document standalone audits

Open MikeWallis42 opened this issue 1 year ago • 1 comments

As part of this issue I raised #3665 I discovered this functionality within sqlmesh isn't covered in the documentation.

MikeWallis42 avatar Jan 21 '25 08:01 MikeWallis42

So far I plan to add this to docs/concepts/audits.md but could someone perhaps clarify for me if they are run as part of sqlmesh run/plan? Or are they only run with sqlmesh audit? Also how are they scheduled? Do they end up with a default cron of @daily as it's not configurable?

Standalone Audits

It is also possible to configure audits to be standalone, these audits are not run after any model specifically.

AUDIT (
  name assert_item_price_is_not_null,
  dialect spark,
  standalone TRUE,
  depends_on (
    sushi.items
  )
);
SELECT * from sushi.items
WHERE
  ds BETWEEN @start_ds AND @end_ds
  AND price IS NULL;

Standalone audits cannot be blocking, only non-blocking as sqlmesh will not know which model should be blocked.

MikeWallis42 avatar Jan 21 '25 08:01 MikeWallis42