Predicates¶
col() builds the conditions a ColRule or a Check carries. Unlike a raw
pl.Expr, a predicate built this way survives a round trip through a spec
file -- see Specs as files.
col¶
Pred¶
Pred
dataclass
¶
Base class of every predicate node. Build one with col().
children
¶
children() -> tuple[Pred, ...]
The operand nodes this one is built from, in written order.
The three traversals below are derived from this, so a node only has to say what it is made of. A leaf returns nothing.
rebuild
¶
This node with children in place of its own, same order.
A leaf ignores them and returns itself.
literals
¶
Every constant this predicate compares against.
Used to check a rule's operands against the column's own domain.
rename
¶
rename(mapping: Mapping[str, str]) -> Pred
The same predicate with its columns renamed by mapping.
Derived, so a node cannot be added that silently fails to rename -- which would leave a rule pointing at a column that no longer exists and only surface much later, as a spec failing its own validation.
is_between
¶
A predicate true where this value falls within [lower, upper].