# MultiValidate.from_files()

Collect validations saved with [write_results()](../reference/write_results.md#pointblank.write_results) or [write_file()](../reference/write_file.md#pointblank.write_file).

Usage

[Source](https://github.com/posit-dev/pointblank/blob/main/pointblank/multivalidate.py#L210-L316)

``` python
MultiValidate.from_files(
    files,
    order="time",
)
```

The [from_files()](../reference/MultiValidate.from_files.md#pointblank.MultiValidate.from_files) method reads the results files written by [`write_results()`](../reference/write_results.md#pointblank.write_results) (with [`read_results()`](../reference/read_results.md#pointblank.read_results)) and the validations saved with [`write_file()`](../reference/write_file.md#pointblank.write_file) (with [`read_file()`](../reference/read_file.md#pointblank.read_file)), and collects them in a [MultiValidate](../reference/MultiValidate.md#pointblank.MultiValidate) object. This is how the results of jobs that ran separately, perhaps on other machines, can be put in one report. The validations don't need to have been saved with their tables (`keep_tbl=True`), since the reports and the roll-up methods only use the results.

> **Warning**
>
> The files of [write_file()](../reference/write_file.md#pointblank.write_file) (`.pkl` files) are Python pickles, and reading one can run code that's in it. Only read them if you trust them, such as those written by your own jobs. Results files (`.json` files) are safe to read from any source.

## Parameters

`files: str | Path | list[str | Path] | tuple[str | Path, …]`  
The files to read. This can be a path to a file, a directory (all of its `.json` and `.pkl` files are read), a glob pattern (e.g., `"results/*.json"`), or a list of paths to files. A `.json` file is read as a results file and any other file as a file of [write_file()](../reference/write_file.md#pointblank.write_file) (as in [read_file()](../reference/read_file.md#pointblank.read_file), a path without an extension gets `.pkl`).

`order: Literal["time", "given"] = "time"`  
The order of the runs: `"time"` (the default) orders them by the time their interrogation ended, and `"given"` keeps the order of the files (for a directory or a pattern, the files are sorted by name).

## Returns

`MultiValidate`  
A [MultiValidate](../reference/MultiValidate.md#pointblank.MultiValidate) object with a run for each file.

## Raises

`FileNotFoundError`  
If a directory or a pattern matches no files.

## Examples

Let's say that two jobs each validated a table and wrote the results to the `results` directory with [write_results()](../reference/write_results.md#pointblank.write_results).

``` python
import pointblank as pb
import tempfile
from pathlib import Path

results = Path(tempfile.mkdtemp()) / "results"

for tbl_name in ["small_table", "game_revenue"]:
    validation = (
        pb.Validate(data=pb.load_dataset(dataset=tbl_name), tbl_name=tbl_name)
        .row_count_match(count=2000)
        .interrogate()
    )
    pb.write_results(validation, filename=tbl_name, path=results)
```

A later step of the process collects the results with a glob pattern (or just the directory) and checks the whole set:

``` python
multi = pb.MultiValidate.from_files(str(results / "*.json"))

len(multi), multi.all_passed()
```

    (2, False)

Only `game_revenue` has 2,000 rows, so the set doesn't pass. Displaying `multi` (or its [`get_tabular_report()`](../reference/MultiValidate.get_tabular_report.md#pointblank.MultiValidate.get_tabular_report)) would show why.
