Skip to content

conditional

sqllocks_spindle.engine.strategies.conditional

Conditional strategy — generate values based on a per-row condition.

Evaluates a condition on already-generated columns and applies one of two inline generator configs, selecting the result per row.

Supported condition forms

"column IS NOT NULL" "column IS NULL" "column == value" "column != value"

Inline generator types for true_generator / false_generator: {"fixed": value} — constant for matching rows {"strategy": "lookup", ...} — same params as LookupStrategy

Example

"discount_percent": { "generator": { "strategy": "conditional", "condition": "promotion_id IS NOT NULL", "true_generator": { "strategy": "lookup", "source_table": "promotion", "source_column": "discount_pct", "via": "promotion_id" }, "false_generator": {"fixed": 0.0} } }

Classes

ConditionalStrategy

Bases: Strategy

Generate column values conditionally based on another column's state.