# Reporting on Many Runs

The `pb validate` and `pb run` commands report on one validation at a time. Validations are often run on a schedule, though, with a job for each table, and the questions that matter then are about all of the runs: which tables need attention now, and how did they get there? The `pb report` command answers those questions from the terminal. It reads the results files of many runs and prints a table of them, with the runs that most need attention first.

`pb report` is the command-line form of [`MultiValidate`](../../reference/MultiValidate.md#pointblank.MultiValidate), which is covered in [Multiple Validations](../post-interrogation/multiple-validations.md).

## Writing Results Files

`pb report` reads *results files*, which hold the results of an interrogation (and none of the data) as plain JSON. A validation script writes one with [`write_results()`](../../reference/write_results.md#pointblank.write_results) after interrogating, so that every run leaves a file behind:

``` python
import datetime
import pointblank as pb

validation = (
    pb.Validate(data=pb.load_dataset("small_table"), tbl_name="orders", thresholds=(1, 2, 3))
    .col_vals_not_null(columns="d")
    .col_vals_gt(columns="d", value=0)
    .interrogate()
)

today = datetime.date.today().isoformat()
pb.write_results(validation, filename=f"{today}_orders", path="results")
```

A validation that's run with `pb run` doesn't need the call. The `--write-results` option writes a results file for each validation of the script or YAML config to a directory:

``` bash
pb run orders.yaml --write-results results/
```

    ✓ Results saved to: results/20261129T020014Z_orders.json

Each file is named by the time its interrogation ended (in UTC) and the table name, so that the files of a directory sort by time and the file of an earlier run is never overwritten.

For the examples on this page, three tables (`orders`, `customers`, and `payments`) were validated every night for a week, and each run wrote its file to the `results/` directory:

    results/
    ├── 2026-11-23_customers.json
    ├── 2026-11-23_orders.json
    ├── 2026-11-23_payments.json
    ├── ...
    ├── 2026-11-29_customers.json
    ├── 2026-11-29_orders.json
    └── 2026-11-29_payments.json

## The Summary of Every Run

Give `pb report` a directory, and it reads all of the `.json` files in it:

``` bash
pb report results/
```

![](../../assets/pb-report-summary.png)

There's a row for each run, and the runs that most need attention come first: those that reached the critical level, then the error level, then the warning level, then those with failing test units, and last those that passed. The colored dot at the start of each row gives the run's status at a glance, and the line below the title tallies the runs by status and gives the times of the first and last runs. The health score is the share of test units that passed in the run.

`pb report` also takes paths to files and glob patterns (which can be in quotes, so that `pb report` expands them itself), and any number of them:

``` bash
pb report results/2026-11-29_*.json
pb report "results/*_orders.json" "results/*_payments.json"
```

In a narrow terminal, the table gets more compact rather than being squeezed: the time of each run is left out first, and then the health bar and labels are shortened.

## A Row for Each Table

When the question is "how are the tables doing now?", use `--by tbl_name`. Each table gets a row with the values of its latest run, the number of its runs, and a trend of the health scores of its runs:

``` bash
pb report results/ --by tbl_name --fail-on error
```

![](../../assets/pb-report-by-tbl-name.png)

The `payments` table reached the critical level in its latest run, and its trend shows that this is new. The `orders` table passed its latest run, although the dip in its trend shows a run with a warning earlier in the week.

The `--fail-on` option works as in `pb run`: the command exits with a code of `1` when a run reached the given threshold level ([critical](../../reference/Validate.critical.md#pointblank.Validate.critical), [error](../../reference/Validate.error.md#pointblank.Validate.error), or [warning](../../reference/Validate.warning.md#pointblank.Validate.warning)), or with `any`, when any test unit failed or a step couldn't be evaluated. With `--by tbl_name`, only the latest run of each table counts, so a table that failed on Tuesday but passed since then doesn't stop the pipeline. That makes `pb report results/ --by tbl_name --fail-on error` a good last step for a scheduled job or a CI workflow.

## Following the Steps Across Runs

The wide report has a row for each validation step and a column for each run, so that a step can be followed from run to run. It works best with the runs of a single table:

``` bash
pb report "results/*_customers.json" --mode wide
```

![](../../assets/pb-report-wide.png)

Each cell has the fraction of the step's test units that passed in the run, in the color of the step's status, and the trend at the end charts the step over the runs. Here, both steps of the `customers` validation started failing on November 28. Steps are matched across the runs by what they check, so a step stays in its row even when steps are added to or removed from the validation between runs.

The wide report shows the 20 most recent runs, and `--max-runs` changes that number. When the runs don't all fit the width of the terminal, the earliest ones are left out, and a note below the table says how many.

## The Failing Steps of Each Run

The long report adds the failing steps of every run that had any, below the summary of the runs:

``` bash
pb report "results/2026-11-2[89]_*.json" --mode long
```

![](../../assets/pb-report-long.png)

Each run's steps show the number of test units, the number and fraction of them that failed, and the threshold level that was reached.

## Saving an HTML Report

With `--output-html` (or `-o`), `pb report` saves the report as a web page instead of printing it:

``` bash
pb report results/ --by tbl_name -o status.html
```

    ✓ HTML report on 21 runs saved to: status.html

The page has the same report as [`MultiValidate.get_tabular_report()`](../../reference/MultiValidate.get_tabular_report.md#pointblank.MultiValidate.get_tabular_report) in Python, for each of the three values of `--mode`. In the long report, each run has a section that can be opened and closed, with the run's full validation report inside. The `--title` and `--lang` options set the title and language of the report, in the terminal and on the page:

``` bash
pb report results/ --title "Nightly checks" --lang fr -o rapport.html
```

## Results Files and Pickles

`pb report` only reads results files. The `.pkl` files written by [`write_file()`](../../reference/write_file.md#pointblank.write_file) are Python pickles, and reading a pickle can run code that's in it, so `pb report` stops with an error when it's given one. Save the results with [write_results()](../../reference/write_results.md#pointblank.write_results) instead. For pickles you trust, collect them in Python with [`MultiValidate.from_files()`](../../reference/MultiValidate.from_files.md#pointblank.MultiValidate.from_files).

## Wrapping Up

With every run of a validation leaving a results file behind, `pb report` turns a directory of them into an answer: the summary shows which runs need attention, `--by tbl_name` shows how each table is doing now, and the wide report shows how each step got there. Add `--fail-on` to stop a pipeline, or `-o` to publish the report as a web page.
