Skip to content

common_dagster.checks

checks.py — the ready-made check factories (Dagster asset checks underneath).

A factory targets the step’s LANDED table (it requires produces=) and queries it through the flow’s DBClient at check time. Custom logic = @check methods on the flow class; these factories cover the generic floor.

All SQL is COMPOSED (identifiers via psycopg.sql, values as params) — the house law; a factory never interpolates. row_delta’s previous count is DURABLE through the store’s stash/retrieve (a fresh pod per run means process memory is amnesia by construction — the old per-process dict could never fire).

Classes

CheckFactory

A declared generic check: named, blocking-optional, table-addressed.

__init__

def __init__(kind: str, params: dict, blocking: bool = False) -> None

Fields and properties declared here; inherited members belong to the bases above.

blocking

blocking: bool = False

kind

kind: str

name

Read-only property.

name: str

params

params: dict

evaluate

def evaluate(db: Any, table: str) -> tuple[bool, dict]

Run against the landed table → (passed, metadata).

Functions

fresh

def fresh(days: int, column: str = 'date', *, blocking: bool = False) -> CheckFactory

max(column) is within the last N days — the staleness tripwire.

nonempty

def nonempty(*, blocking: bool = False) -> CheckFactory

The table has rows at all.

row_delta

def row_delta(max_drop_pct: float, *, blocking: bool = True) -> CheckFactory

Row count never DROPS more than max_drop_pct vs the last DURABLY seen count (a shrinking raw table = something destructive happened). The previous count survives process boundaries via the store table.

unique_key

def unique_key(*columns: str, blocking: bool = False) -> CheckFactory

No duplicate rows on the given key columns (the census-PK guard).