Validate.to_yaml()
Serialize this validation plan to a yaml_interrogate()-compatible YAML config.
Usage
Validate.to_yaml(path=None)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
tblfield is set fromtbl_namewhen available, otherwise to the placeholderyour_data; set it to a loadable data source before passing the YAML to yaml_interrogate().
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
import pointblank as pb
validation = (
pb.Validate(data=pb.load_dataset("small_table"), tbl_name="small_table")
.col_vals_gt(columns="d", value=100)
.col_vals_not_null(columns="a")
)
print(validation.to_yaml())