Index
State module for managing deployment and migration state.
AzureBlobStateClient
¶
Bases: StateClient
Read and write state as JSON blobs in Azure Blob Storage.
The path argument is interpreted as the blob name inside the configured container.
Requires the azure-storage-blob package to be installed::
uv add azure-storage-blob
Authentication priority:
- The account_key constructor argument, when provided explicitly.
- The
AZURE_STORAGE_ACCOUNT_KEYenvironment variable. -
DefaultAzureCredentialfrom theazure-identitypackage::uv add azure-identity
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_name
|
str
|
Azure Storage Account name. |
required |
container_name
|
str
|
Name of the blob container to use. |
required |
account_key
|
str | None
|
Azure Storage Account key. When |
None
|
Source code in src/cloe_delta_table_manager/state/clients/azure.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
__init__(account_name, container_name, *, account_key=None)
¶
Initialize the Azure Blob Storage state client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_name
|
str
|
Azure Storage Account name. |
required |
container_name
|
str
|
Name of the blob container to use. |
required |
account_key
|
str | None
|
Azure Storage Account key. When |
None
|
Raises:
| Type | Description |
|---|---|
ImportError
|
If azure-storage-blob (or azure-identity when no account key is available) is not installed. |
Source code in src/cloe_delta_table_manager/state/clients/azure.py
read_state(path, state_type)
¶
Read state from an Azure Blob Storage blob.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Blob name within the configured container. |
required |
state_type
|
type[StateT]
|
The concrete State subclass to deserialize into. |
required |
Returns:
| Type | Description |
|---|---|
StateT
|
A State instance loaded from the blob. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the blob does not exist. |
Source code in src/cloe_delta_table_manager/state/clients/azure.py
state_exists(path)
¶
Check whether a state blob exists in Azure Blob Storage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Blob name within the configured container. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the blob exists, False otherwise. |
Source code in src/cloe_delta_table_manager/state/clients/azure.py
write_state(path, state)
¶
Write state to an Azure Blob Storage blob.
The container is created automatically if it does not exist. The version in the state metadata is incremented before writing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Blob name within the configured container. |
required |
state
|
State
|
The State instance to persist. |
required |
Source code in src/cloe_delta_table_manager/state/clients/azure.py
DatabaseState
¶
Bases: State, Databases
State of the latest deployment as a collection of databases.
Source code in src/cloe_delta_table_manager/state/state.py
LocalStateClient
¶
Bases: StateClient
Read and write state as JSON files on the local filesystem.
The path argument is interpreted as a filesystem path (absolute or relative).
Source code in src/cloe_delta_table_manager/state/clients/local.py
read_state(path, state_type)
¶
Read state from a local JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Filesystem path to the JSON state file. |
required |
state_type
|
type[StateT]
|
The concrete State subclass to deserialize into. |
required |
Returns:
| Type | Description |
|---|---|
StateT
|
A State instance loaded from the file. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the file does not exist. |
Source code in src/cloe_delta_table_manager/state/clients/local.py
state_exists(path)
¶
Check whether a state file exists on the local filesystem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Filesystem path to check. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the file exists, False otherwise. |
Source code in src/cloe_delta_table_manager/state/clients/local.py
write_state(path, state)
¶
Write state to a local JSON file.
Parent directories are created automatically if they do not exist. The version in the state metadata is incremented before writing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Filesystem path for the JSON state file. |
required |
state
|
State
|
The State instance to persist. |
required |
Source code in src/cloe_delta_table_manager/state/clients/local.py
MigrationState
¶
State
¶
Bases: BaseModel
State of the latest deployment.
Source code in src/cloe_delta_table_manager/state/state.py
from_file(path, client=None)
classmethod
¶
Load state using the given client, defaulting to the local filesystem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Location identifier for the state (file path for local, blob name for Azure, etc.). |
required |
client
|
StateClient | None
|
State client to use. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Self
|
State instance loaded from the given path. |
Source code in src/cloe_delta_table_manager/state/state.py
to_file(path, client=None)
¶
Save state using the given client, defaulting to the local filesystem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Location identifier for the state (file path for local, blob name for Azure, etc.). |
required |
client
|
StateClient | None
|
State client to use. Defaults to |
None
|
Source code in src/cloe_delta_table_manager/state/state.py
StateClient
¶
Bases: ABC
Abstract base class for reading and writing state from different source systems.
Source code in src/cloe_delta_table_manager/state/clients/base.py
read_state(path, state_type)
abstractmethod
¶
Read state from the source system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Location identifier for the state (interpretation depends on the client). |
required |
state_type
|
type[StateT]
|
The concrete State subclass to deserialize into. |
required |
Returns:
| Type | Description |
|---|---|
StateT
|
A State instance loaded from the source system. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the state does not exist at the given path. |
Source code in src/cloe_delta_table_manager/state/clients/base.py
state_exists(path)
abstractmethod
¶
Check whether a state exists at the given path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Location identifier for the state. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the state exists, False otherwise. |
Source code in src/cloe_delta_table_manager/state/clients/base.py
write_state(path, state)
abstractmethod
¶
Write state to the source system.
The version in the state metadata is incremented before writing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Location identifier for the state (interpretation depends on the client). |
required |
state
|
State
|
The State instance to persist. |
required |
Source code in src/cloe_delta_table_manager/state/clients/base.py
StateMetadata
¶
Bases: BaseModel
Metadata of the state.