base
sqllocks_spindle.engine.strategies.base
¶
Base strategy interface and registry.
Classes¶
GenerationContext
¶
Context passed to strategies during generation.
Provides access to the RNG, ID manager, current table state, model config, and other strategies' output for the current row batch.
Strategy
¶
Bases: ABC
Base class for all column generation strategies.
Methods:¶
generate(column, config, ctx)
abstractmethod
¶
Generate values for a column.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column
|
ColumnDef
|
The column definition from the schema. |
required |
config
|
dict[str, Any]
|
The generator config dict from the column def. |
required |
ctx
|
GenerationContext
|
The generation context with RNG, ID manager, etc. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
numpy array of generated values with length ctx.row_count. |
apply_nulls(values, column, ctx)
¶
Apply null values based on the column's null_rate.
StrategyRegistry
¶
Registry mapping strategy names to Strategy instances.
Methods:¶
load_entrypoint_plugins(group='spindle.strategies')
¶
Discover and register strategies from installed entrypoint plugins.
Third-party packages can register custom strategies by defining an
entrypoint in their pyproject.toml::
[project.entry-points."spindle.strategies"]
my_strategy = "my_package.strategies:MyStrategy"
The entrypoint value must be a class implementing :class:Strategy.