KV API implementation on Azure Blob Storage
Project description
Key-Value: Azure Blob
Implementation of the
KV[T]
async Key-Value ABC, over Azure Blob Storage
(kv-api
)
pip install kv-azure-blob
Usage
Raw
from azure.storage.blob.aio import BlobServiceClient
from kv.azure.blob import BlobKV
bsc: BlobServiceClient = ...
kv = BlobKV[bytes](bsc)
await kv.insert('img1', b'...')
await kv.read('img2')
await kv.keys()
# etc.
Pydantic-validated
from dataclasses import dataclass
@dataclass
class User:
username: str
email: str
cc: ContainerClient = ...
kv = BlobKV.validated(User, cc)
await kv.insert('user1', User(username='user1', email='...'))
# etc.
Containers
By default, keys are split across containers:
'users/path/to/user.txt'
goes to containerusers
'admins/path/to/admin.txt'
goes to containeradmins
You can customize this behavior by passing a def split_key(key: str) -> tuple[str, str]
function.
- E.g. using
split_key=lambda key: ('container', key)
will always store in'container'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
kv_azure_blob-0.1.6.tar.gz
(4.8 kB
view hashes)
Built Distribution
Close
Hashes for kv_azure_blob-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a29c2a7a949bc2679fa068650a6a9c7b390e4f9d18ebd3c03efb42870a26efa |
|
MD5 | 8da71453902042b25cee95c8da924237 |
|
BLAKE2b-256 | 14021a3340d6aa6334b94b5ab2df8a0dbea7dcb726e33473b11163c9f1e93ffc |