wiring.evaluate_checks()

Yield a result for each check build_asset_check_specs declares, without writing any rows.

Usage

Source

wiring.evaluate_checks(
    schema,
    frame,
    *,
    asset_key,
    check_granularity=None,
    max_failure_examples=None
)

Each failing rule’s check has its rule’s severity, as in dd.asset.

Parameters

schema: type[dy.Schema]

The schema whose rules the frame is checked against.

frame: pl.DataFrame | pl.LazyFrame

The frame to check. A pl.LazyFrame is collected once.

asset_key: dg.AssetKey

The key of the asset the results report on, which the specs name too.

check_granularity: Granularity | None = None

Pass the value build_asset_check_specs received, or the results name checks the asset does not declare. None uses DAGSTER_DATAFRAMELY_CHECK_GRANULARITY if set, else rule.

max_failure_examples: int | None = None
A rule’s check metadata has at most this many rows that failed it. None uses DAGSTER_DATAFRAMELY_MAX_FAILURE_EXAMPLES if set, else 5.

Yields

dg.AssetCheckResult
The column-schema check’s result, then one result per rule set, in the order of build_asset_check_specs.

Raises

InvalidSettingError

A setting’s argument or environment variable has a value the setting does not allow.

ReservedColumnError

A column name is in the reserved dy_ namespace.

InvalidColumnNameError

A column name has a character Dagster does not allow in an asset check name.

CheckNameCollisionError

Two rules produce the same asset check name.

InvalidSeverityError

The schema declares a severity this package cannot read.

ColumnSchemaError
The frame’s columns or dtypes do not match the schema. It yields the column-schema check’s failing result first.

Examples

import dagster as dg

import dagster_dataframely as dd
from dagster_dataframely.data import OrdersSchema, marketplace_orders

results = dd.wiring.evaluate_checks(
    OrdersSchema, marketplace_orders, asset_key=dg.AssetKey("orders")
)
[result.check_name for result in results if not result.passed]
['dy_rule__paid_orders_have_amount',
 'dy_rule__line_numbers_are_dense',
 'dy_rule__order_id__regex',
 'dy_rule__email__check__lowercase',
 'dy_rule__amount__min',
 'dy_rule__quantity__max',
 'dy_rule__priority__is_in']