auto
AutoMigrationRunner — generates and executes migrations from state diffs.
AutoMigrationRunner
¶
Bases: MigrationRunner
Generate migrations from a state diff and execute them.
The runner compares a current state (read from the database statefile)
against a desired state (parsed from SQL files) and generates the SQL
migrations needed to reconcile the two. After execution the applied
migrations are persisted to auto_migration_state_path for observability.
Source code in src/cloe_delta_table_manager/migrations/runner/auto.py
__init__(*, executor=None, state_client=None, platform_options=None)
¶
Initialize the AutoMigrationRunner.
Source code in src/cloe_delta_table_manager/migrations/runner/auto.py
execute_migrations(*, current_state, desired_state, statefile_path)
¶
Generate and execute auto migrations, then persist state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
current_state
|
DatabaseState
|
The database state as recorded in the statefile. |
required |
desired_state
|
DatabaseState
|
The desired state derived from SQL source files. |
required |
statefile_path
|
str | Path
|
Path to persist the auto migration state after execution. |
required |
Source code in src/cloe_delta_table_manager/migrations/runner/auto.py
list_pending_migrations(*, current_state, desired_state)
¶
Return auto-generated migrations without executing them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
current_state
|
DatabaseState
|
The database state as recorded in the statefile. |
required |
desired_state
|
DatabaseState
|
The desired state derived from SQL source files. |
required |
Returns:
| Type | Description |
|---|---|
list[Migration]
|
List of generated Migration objects. |