azure
State client for Azure Blob Storage.
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 |