# hydra_interrogate()

Compose a validation configuration with Hydra and run it.

Usage

[Source](https://github.com/posit-dev/pointblank/blob/main/pointblank/hydra.py#L412-L529)

``` python
hydra_interrogate(
    config=None,
    overrides=None,
    config_dir=None,
    set_tbl=None,
    namespaces=None,
    allow_python=False,
)
```

This composes the configuration with [`hydra_compose()`](../reference/hydra_compose.md#pointblank.hydra_compose) and then does what [`yaml_interrogate()`](../reference/yaml_interrogate.md#pointblank.yaml_interrogate) does with a plain YAML configuration.

## Parameters

`config: str | Path | None = None`  
The path to a YAML file to compose (see [hydra_compose()](../reference/hydra_compose.md#pointblank.hydra_compose)).

`overrides: Iterable[str] | None = None`  
Hydra overrides (see [hydra_compose()](../reference/hydra_compose.md#pointblank.hydra_compose)).

`config_dir: str | Path | None = None`  
A directory to add to the search path.

`set_tbl: Any = None`  
A table to validate in place of the one in the configuration.

`namespaces: Iterable[str] | Mapping[str, str] | None = None`  
Modules to make available to Python code in the configuration, as a mapping of aliases to module names or a list of module names. This only has an effect with `allow_python=True`.

`allow_python: bool = False`  
Whether to run the Python code in the configuration: the code of `python:` blocks (see [yaml_interrogate()](../reference/yaml_interrogate.md#pointblank.yaml_interrogate)), and the mappings with a `_target_` key, which are made into the Python objects they describe. Without this, a configuration with such code raises an error. Only set it for configurations that you trust.

## Returns

`Validate`  
The interrogated validation.

## Raises

`ImportError`  
If neither `hydra-core` nor `lerna` is installed.

`YAMLValidationError`  
If the configuration can't be composed, isn't valid, or can't be run.

## Examples

Let's write a check collection and a configuration that selects it to a temporary directory. The configuration also selects the `small_table` dataset and the `standard` thresholds, which are options that come with Pointblank.

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

config_dir = Path(tempfile.mkdtemp())
(config_dir / "pointblank" / "checks").mkdir(parents=True)

(config_dir / "pointblank" / "checks" / "ids.yaml").write_text('''
# @package checks.ids
steps:
- col_vals_not_null:
    columns: ${vars.id_column}
''')

(config_dir / "small_table.yaml").write_text('''
defaults:
- override /pointblank/tbl: small_table
- override /pointblank/thresholds: standard
- override /pointblank/checks:
    - ids
- _self_

vars:
  id_column: a

steps:
- rows_distinct
''')

pb.hydra_interrogate(config_dir / "small_table.yaml")
```

[TABLE]

The validation has the step of the collection, followed by the step of the configuration. Overrides change what's selected for one run. Here the same checks are run on another column with the `strict` thresholds:

``` python
pb.hydra_interrogate(
    config_dir / "small_table.yaml",
    overrides=["pointblank/thresholds=strict", "vars.id_column=c"],
)
```

[TABLE]

Column `c` has two missing values, so the first step now fails for two of the 13 test units, which is enough to reach all three levels of the `strict` thresholds.
