# Standard.apply()

Validate every table of a source that the standard applies to.

Usage

[Source](https://github.com/posit-dev/pointblank/blob/main/pointblank/standard.py#L1258-L1398)

``` python
Standard.apply(
    source,
    applies_to=None,
)
```

This method finds the tables of a source, selects them with the `applies_to=` selector, and validates each one with the standard's steps (as [`validate()`](../reference/Standard.validate.md#pointblank.Standard.validate) does). Each table gets a validation of its own, named with the table's name, so a table that fails doesn't stop the others from being validated. The results come back in a [`StandardResult`](../reference/StandardResult.md#pointblank.StandardResult), which shows all the validations in one report and tells which tables failed.

The tables are found when the method is called, so applying a standard on a schedule validates new tables as they appear.

## 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`](../reference/Standard.md#pointblank.Standard)).

`applies_to: TableSelector | None = None`  
A table selector that's used instead of the standard's `applies_to=`. If neither is given, every table of the source is validated.

## Returns

`StandardResult`  
The validations of the tables, in the order of the source. A table that couldn't be read is in its [`errors`](../reference/StandardResult.md#pointblank.StandardResult) instead.

## Raises

`TypeError`  
If `source=` isn't one of the kinds of sources, or a step's arguments don't fit its validation method.

`FileNotFoundError`  
If `source=` is a path that doesn't exist.

## Warns

`UserWarning`  
If no table of the source is selected (the result is then empty).

## Examples

Let's set up a DuckDB database with a few tables in two schemas: the tables of the default schema (`main`) are raw extracts, and the `marts` schema has the tables that analysts use.

``` python
import ibis
import pointblank as pb
import polars as pl

con = ibis.duckdb.connect()
con.raw_sql("CREATE SCHEMA marts")

con.create_table("raw_events", pl.DataFrame({"event_id": [1, 1, 2]}))
con.create_table(
    "dim_customers",
    pl.DataFrame({"customer_id": [1, 2, 3], "region": ["EU", "US", None]}),
    database="marts",
)
con.create_table(
    "dim_products",
    pl.DataFrame({"product_id": [10, 11], "category": ["toys", "books"]}),
    database="marts",
)
con.create_table(
    "fct_sales",
    pl.DataFrame({"customer_id": [1, 2, 2], "product_id": [10, 10, 11]}),
    database="marts",
)

con.list_tables(database="marts")
```

    ['dim_customers', 'dim_products', 'fct_sales']

Our standard for dimension tables says that each must have unique rows and that its columns are complete. It applies to the tables of the `marts` schema whose names start with `"dim_"`.

``` python
dim_standard = pb.Standard(
    name="dimension-tables",
    version="2.1.0",
    steps=[
        pb.Step("rows_distinct"),
        pb.Step("col_vals_not_null", columns=pb.everything()),
    ],
    applies_to=pb.in_schema("marts") & pb.tbl_starts_with("dim_"),
)

result = dim_standard.apply(con)

result
```

Standard: dimension-tables v2.1.0

FAIL

TABLES

2

PASS

1

FAIL

1

Health Score

93.33%

2026-12-04 20:42:53 UTC

[](#pb-mv-run-1 "1. marts.dim_customers (FAIL)")[](#pb-mv-run-2 "2. marts.dim_products (PASS)")

STEPS

PASS

FAIL

Health Score

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0icGItbXYtY2hldnJvbiIgd2lkdGg9IjEwIiBoZWlnaHQ9IjEwIiB2aWV3Ym94PSIwIDAgMTAgMTAiIHN0eWxlPSJmbGV4OiBub25lOyBkaXNwbGF5OiBibG9jazsiIGFyaWEtaGlkZGVuPSJ0cnVlIj48cGF0aCBkPSJNMy41IDEuNSBMNyA1IEwzLjUgOC41IiBmaWxsPSJub25lIiBzdHJva2U9IiM4ODg4ODgiIHN0cm9rZS13aWR0aD0iMS42IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIC8+PC9zdmc+)1DuckDBmarts.dim_customersStandard: dimension-tables v2.1.0

2026-12-04 20:42:53 UTC

3

2

1

88.89%

[TABLE]

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0icGItbXYtY2hldnJvbiIgd2lkdGg9IjEwIiBoZWlnaHQ9IjEwIiB2aWV3Ym94PSIwIDAgMTAgMTAiIHN0eWxlPSJmbGV4OiBub25lOyBkaXNwbGF5OiBibG9jazsiIGFyaWEtaGlkZGVuPSJ0cnVlIj48cGF0aCBkPSJNMy41IDEuNSBMNyA1IEwzLjUgOC41IiBmaWxsPSJub25lIiBzdHJva2U9IiM4ODg4ODgiIHN0cm9rZS13aWR0aD0iMS42IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIC8+PC9zdmc+)2DuckDBmarts.dim_productsStandard: dimension-tables v2.1.0

2026-12-04 20:42:53 UTC

3

3

0

100%

[TABLE]

The standard found the two dimension tables, and the report has a section for each. The `dim_customers` table has a missing region, so it fails:

``` python
result.failing_tables()
```

    ['marts.dim_customers']

The same standard can be applied with another selector, for instance to check the uniqueness of the raw tables too:

``` python
dim_standard.apply(con, applies_to=pb.tbl_starts_with("raw_")).failing_tables()
```

    ['raw_events']

The `raw_events` table has a duplicate row, so it fails the first step.
