## wiring.validation_results()


Validate a frame and yield the asset's materialization and check results.


Usage

``` python
wiring.validation_results(
    schema,
    frame,
    *,
    valid_key,
    quarantine_writer=None,
    check_granularity=None,
    schema_rules=None,
    max_failure_samples=None,
    statistics=None,
    row_sample=None
)
```


## Parameters


`frame: pl.DataFrame | pl.LazyFrame | None`  
The frame to validate, or `None` to skip.

`valid_key: dg.AssetKey`  
The key the run materializes the valid rows under: the asset's own key, such as `context.asset_key`. A key the asset does not have fails the step with `DagsterInvariantViolationError` on the first yield, and the asset writes nothing.

`quarantine_writer: QuarantineWriter | None = None`  
The writer for the invalid rows, called at most once, with the frame [quarantine_frame](wiring.quarantine_frame.md#dagster_dataframely.wiring.quarantine_frame) returns. With `None`, any invalid row fails the run with [ValidationAbortError](errors.ValidationAbortError.md#dagster_dataframely.errors.ValidationAbortError), and the asset writes nothing.

`check_granularity: Granularity | None = None`  
Pass the value [check_specs](wiring.check_specs.md#dagster_dataframely.wiring.check_specs) received, or the results name checks the asset does not declare. `None` uses `DAGSTER_DATAFRAMELY_CHECK_GRANULARITY` if set, else `rule`.

`schema_rules: SchemaRules | None = None`  
Pass the value [check_specs](wiring.check_specs.md#dagster_dataframely.wiring.check_specs) received, as for `check_granularity`. `None` uses `DAGSTER_DATAFRAMELY_SCHEMA_RULES` if set, else `collapsed`.

`max_failure_samples: int | None = None`  
A rule's check metadata has at most this many rows that failed it. `None` uses `DAGSTER_DATAFRAMELY_MAX_FAILURE_SAMPLES` if set, else `5`.

`statistics: bool | None = None`  
Whether the materialization metadata has statistics of the written rows. `None` uses `DAGSTER_DATAFRAMELY_STATISTICS` if set, else `True`.

`row_sample: int | None = None`  
The materialization metadata has at most this many valid rows, and this many invalid rows. `None` uses `DAGSTER_DATAFRAMELY_ROW_SAMPLE` if set, else `5`.


## Yields


`The asset's ``dg.MaterializeResult``, if the run writes its table, then one ``dg.AssetCheckResult`` per check. On a skip, it yields only the check results, and every check passes. It writes the quarantine instead of yielding it.`  


## Raises


`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.

`InvalidSettingError`  
A setting's argument or environment variable has a value the setting does not allow.

`DagsterInvariantViolationError`  
`frame` is neither a Polars frame nor `None`.

`ColumnSchemaError`  
The frame's columns or dtypes do not match the schema. It yields the column-schema check's failing result first, and writes nothing.

`ValidationAbortError`  
Rows failed validation and `quarantine_writer` is `None`, so the package writes nothing.

`NoValidRowsError`  
Every row failed validation. It writes the quarantine, and not the asset's table.
