Skip to main content

StandardsRegistry.apply_all()

Apply every standard of the registry to the tables of a source.

Usage

Source

StandardsRegistry.apply_all(source)

Each standard is applied with Standard.apply(), so it validates the tables of the source that its applies_to= selector chooses, each table separately. A connection string is connected to once, for all the standards.

Parameters

source: Any
The tables: a dictionary of names to tables, an Ibis connection or a connection string, a directory, a glob pattern, or a list of files (see the Sources of Tables section of Standard).

Returns

dict[str, StandardResult]
The StandardResult of each standard, by the standard’s name (in the order of list_standards()).

Examples

Let’s make a registry with a standard for amount columns and one for ID columns, and apply both to three tables.

import pointblank as pb
import polars as pl
import tempfile
from pathlib import Path

standards_dir = Path(tempfile.mkdtemp())

pb.Standard(
    name="amounts",
    steps=[pb.Step("col_vals_ge", columns=pb.ends_with("_amount"), value=0)],
).to_yaml(standards_dir / "amounts.yaml")
pb.Standard(
    name="ids",
    steps=[pb.Step("col_vals_not_null", columns=pb.ends_with("_id"))],
).to_yaml(standards_dir / "ids.yaml")

tables = {
    "orders": pl.DataFrame({"order_id": [1, 2], "order_amount": [20.0, -5.0]}),
    "refunds": pl.DataFrame({"refund_id": [1, None], "refund_amount": [3.0, 4.0]}),
    "regions": pl.DataFrame({"region": ["EU", "US"]}),
}

results = pb.StandardsRegistry(standards_dir).apply_all(tables)

results["amounts"]
Standard: amounts
FAIL
TABLES
3
PASS
1
FAIL
1
Not applicable
1
Health Score
75%
2026-12-04 20:43:51 UTC
STEPS
PASS
FAIL
Health Score
1PolarsordersStandard: amounts
2026-12-04 20:43:51 UTC
1
0
1
50%
Standard: amounts
Polarsorders
STEP COLUMNS VALUES TBL EVAL UNITS PASS FAIL W E C EXT
#4CA64C66 1
col_vals_ge
col_vals_ge()
order_amount 0 ✓ 2 1
0.50
1
0.50
— — —
2PolarsrefundsStandard: amounts
2026-12-04 20:43:51 UTC
1
1
0
100%
Standard: amounts
Polarsrefunds
STEP COLUMNS VALUES TBL EVAL UNITS PASS FAIL W E C EXT
#4CA64C 1
col_vals_ge
col_vals_ge()
refund_amount 0 ✓ 2 2
1.00
0
0.00
— — — —
3PolarsregionsStandard: amounts
2026-12-04 20:43:51 UTC
1
0
0
—
N/A
Standard: amounts
Polarsregions
STEP COLUMNS VALUES TBL EVAL UNITS PASS FAIL W E C EXT
#4CA64C66 1
col_vals_ge
col_vals_ge()
EndsWith(text='_amount', case_sensitive=False) 0 — — — — — — — —

Notes

Step 1 (not_applicable) Not applicable — The column expression EndsWith(text='_amount', case_sensitive=False) does not resolve to any columns.

Each standard has its own result, with its own report. The verdicts of all the standards can be gathered in code:

{name: result.failing_tables() for name, result in results.items()}
{'amounts': ['orders'], 'ids': ['refunds']}

The negative amount fails orders against the amounts standard, and the missing ID fails refunds against the ID standard. The regions table has neither kind of column, so neither standard applies to it.