Skip to main content
Checks are Python nodes that validate other Python nodes. They are the Python analog of SQL audits: audits validate SQL relations, checks validate the output of tasks, assets, and loaders. See Python Nodes for the shared model. Checks are separate graph nodes, not callbacks embedded in a task or asset. A check declares what it validates through depends_on.

Defining a check

Place Python files under checks/ and decorate functions with @check. depends_on is required:
The check receives a CheckContext and reads its dependencies’ persisted results with ctx.result_of(...).

Results

Return a result through the context helpers, or a bool shorthand:
Returning None is not allowed - checks must be explicit.

Severity

@check takes a severity of error (default) or warn:
  • error (default) - a failing check fails sqb build.
  • warn - a failing check is reported but does not fail the build.
ctx.warn(...) always produces a warning regardless of the declared severity.

What checks can depend on

  • Checks may depend on tasks, assets, and loaders.
  • Checks may not depend on SQL models, sources, seeds, or functions. Use SQL audits to validate SQL relations.
  • Checks may not depend on other checks.
  • Checks may not depend on a terminal source loader directly. Validate loaded source data with a source audit instead.
A check that depends on a single node is displayed grouped under that node. Multi-dependency checks are shown as standalone validation nodes, grouped by group, tags, or path.

Decorator parameters

Checks do not support columns, column_lineage, or retry.

Running checks

Checks run automatically during sqb build when their Python dependencies run. They are skipped when --no-audits is passed. To run checks on their own, use sqb check:
sqb check rejects selecting non-check nodes; use sqb build to run tasks and assets. Check results are written to target/run/checks/python_checks.json, and sqb check --json prints them to stdout.

Checks vs audits

sqb build runs both. sqb audit runs SQL audits only; sqb check runs Python checks only.