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('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[ValidationError] | 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.1.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_kv-0.1.1.tar.gz
  • Upload date:
  • Size: 13.2 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.1.tar.gz
Algorithm Hash digest
SHA256 94b5fa4a10b7106e26f77906ddf94c520d5a57f949b6cde9e8f3ff58abf7f302
MD5 4b9a7e98504b120043a0218b0ae3328e
BLAKE2b-256 515a6b12c6f3ab3339f2f3291a342d7d6a9c80b2050dbf9fa79632aa1ba262bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_kv-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 faeab8e6be3500eb9eebf1092ee5637a82627834b72544d0c0517f854c4f6f22
MD5 1bf074192870848f751582cbd45f27be
BLAKE2b-256 4f18dd91f8e26767abf0b588f3426814a926e568f0c35cb73b8bdc78dc793555

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