Skip to main content

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 container users
  • 'admins/path/to/admin.txt' goes to container admins

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


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.3.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

kv_azure_blob-0.1.3-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file kv_azure_blob-0.1.3.tar.gz.

File metadata

  • Download URL: kv_azure_blob-0.1.3.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.6

File hashes

Hashes for kv_azure_blob-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a6fd821f06020444e4729768355e8f6c9639a3a9eca2c6c16153f57f3ac31761
MD5 aac958b3d02642ff485e49adbb8bf483
BLAKE2b-256 45790988ea7e24348a3e98a7d5e2cbd6e36c6d63420c627d821c17f4306ff0c1

See more details on using hashes here.

File details

Details for the file kv_azure_blob-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: kv_azure_blob-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.6

File hashes

Hashes for kv_azure_blob-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d8914a5ad837bdb03288ce71e6c71c755e6feb7930fe74d0430cdeea7cfd2f95
MD5 7f0ed445fab9fb72d823f21cac5be98e
BLAKE2b-256 6b1130631b85bd9c2c6df6db1bbe5efce574f2ed7790318b1357ce2e9706d2a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page