Skip to content

first_per_parent

sqllocks_spindle.engine.strategies.first_per_parent

First-per-parent strategy — mark the first child row per parent group.

Generates a boolean column where the first row for each parent FK value is True and all subsequent rows are False. Used for flags like address.is_primary.

Example

"is_primary": { "generator": { "strategy": "first_per_parent", "parent_column": "customer_id", "default": true } }

Classes

FirstPerParentStrategy

Bases: Strategy

Mark the first row per parent FK group as True, rest as False.