Skip to main content

Async, exception-free key-value store ABC. Implementations over SQLAlchemy, the filesystem, Redis, Azure Blob, and more.

Project description

KV

Async, exception-free key-value store ABC. Implementations over SQLAlchemy, the filesystem, Redis, Azure Blob, and more.

pip install python-kv

Usage

from kv import KV

kv = KV.of('sql+sqlite:///path/to/db.sqlite') # easiest way to switch backends: connection strings

await kv.insert('key', 'value') # Left[DBError] | Right[None]
await kv.read('key') # Left[ReadError] | Right['value']
await kv.delete('key') # Left[DBError] | Right[None]
[k async for k in kv.keys()] # list[Left[ReadError] | Right[T]]
[it async for it in kv.items()] # list[Left[ReadError] | Right[tuple[str, T]]]
await kv.clear() # Left[DBError] | Right[None]
# and a few more

Serialization & Validation

from dataclasses import dataclass

@dataclass
class MySerializableType:
  a: int
  b: str

kv = KV.of('sql+sqlite://...', MySerializableType)
await kv.insert('key', MySerializableType(1, '2')) # Left[InvalidData] | Right[None]
# etc.

CLI

kv serve CONN_STR --token "shhhhh" --port 8080 --type dict
kv test CONN_STR # runs some basic tests

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

python_kv-0.1.3.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

python_kv-0.1.3-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_kv-0.1.3.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for python_kv-0.1.3.tar.gz
Algorithm Hash digest
SHA256 834e08ad35bbdef99acae60a4a0bc1d223eaf72ee5ae1c8d8531bfa7d900e07e
MD5 3c5c2e766ad09dd741762fec6f16fd1b
BLAKE2b-256 ad7a7c8be931a0fdc3ef3129bdadfef5e4b7b698ec77670928e0c96111555a59

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_kv-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for python_kv-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f53ba902e486c1831f67735e766297555b18ab319503d3e464947da241d30913
MD5 aa38c6af363d64c2f0b7839fe4e8b562
BLAKE2b-256 17a37ebcb9797dfa5fccaa6eb64842b25ba685e86b8ee80ed91024e9c71b9073

See more details on using hashes here.

Supported by

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