The to_yaml() method renders the validation plan as a YAML document using the same schema consumed by yaml_interrogate(). This enables storing plans as configuration, sharing them across projects, and round-tripping a plan through YAML.
Parameters
path:str | Path | None=None
An optional file path. If provided, the YAML is written to this file (parent directories are created as needed) in addition to being returned.
Returns
str
The validation plan as a YAML string. The tbl field is set from tbl_name when available, otherwise to the placeholder your_data; set it to a loadable data source before passing the YAML to yaml_interrogate(). The reference field is written the same way as in to_code(): a file path or connection string as-is, and the placeholder your_reference_data (with a warning) for an in-memory table.
Notes On Fidelity
As with to_code(), steps carrying non-serializable Python objects (pre= callables, actions=, callable active=, and the expressions of col_vals_expr()/conjointly()/specially()) cannot be represented in YAML; a placeholder is emitted and a warning is raised.
Examples
Let’s create a validation plan for the small_table dataset and write it as YAML.
tbl: small_table
tbl_name: small_table
thresholds:
warning: 0.1
error: 0.2
steps:
- col_vals_gt:
columns: d
value: 100
- col_vals_not_null:
columns: c
- col_vals_in_set:
columns: f
set:
- low
- mid
- high
Each step becomes an entry under steps, named after its method and with its arguments beneath. The tbl field was set from tbl_name=. Here, that name happens to be a dataset that yaml_interrogate() can load, so the YAML runs as is:
pb.yaml_interrogate(yaml_config)
Pointblank Validation
2026-11-05|01:34:19
Polarssmall_tableWARNING0.1ERROR0.2CRITICAL—
STEP
COLUMNS
VALUES
TBL
EVAL
UNITS
PASS
FAIL
W
E
C
EXT
#4CA64C
1
col_vals_gt()
d
100
✓
13
13 1.00
0 0.00
○
○
—
—
#AAAAAA
2
col_vals_not_null()
c
—
✓
13
11 0.85
2 0.15
●
○
—
#4CA64C
3
col_vals_in_set()
f
low, mid, high
✓
13
13 1.00
0 0.00
○
○
—
—
For a table of your own, set tbl to a file path or connection string before running the YAML. To keep the configuration (for instance, in version control next to the pipeline it checks), give to_yaml() a path=, which writes the file and still returns the string.