Skip to main content

StandardResult.failing_tables()

Get the names of the tables that didn’t pass.

Usage

Source

StandardResult.failing_tables()

A table fails when a test unit of one of its applicable steps failed, when a step couldn’t be evaluated (as when a column named in a step is missing), or when the table couldn’t be read at all (those tables are at the end of the list, and their errors are in errors). Thresholds don’t affect it. To find the tables whose failures reached a threshold level, use the validations, e.g., [name for name, v in result.tables.items() if v.above_threshold(level="error")].

Returns

list[str]
The names of the failing tables.

Examples

A standard that every table has a complete id column finds two failing tables:

import pointblank as pb
import polars as pl

id_standard = pb.Standard(name="ids", steps=[pb.Step("col_vals_not_null", columns="id")])

result = id_standard.apply(
    {
        "orders": pl.DataFrame({"id": [1, 2]}),
        "returns": pl.DataFrame({"id": [None, 3]}),
        "refunds": pl.DataFrame({"refund": [1]}),
    }
)

result.failing_tables()
['returns', 'refunds']

The returns table has a missing ID, and the refunds table has no id column. Since the column is named with a string rather than a selector, the standard requires it, and the step can’t be evaluated.