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

Uploaded Source

Built Distribution

python_kv-0.1.6-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_kv-0.1.6.tar.gz
  • Upload date:
  • Size: 15.1 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.6.tar.gz
Algorithm Hash digest
SHA256 6d6ee9040dc218e50b69c91672a2be9f7a511edd568f9917dad22705d4b3c2b0
MD5 218092c662ab92dc325cb836fd1dcef5
BLAKE2b-256 973dd1aaf0239657744c50a260d03d5e0501574f3ccc252c35cee36949bb0453

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_kv-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 21.8 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d787d1a86c764c6eb4a4922e83e71e39f2d71b882200170acc0659f054cec0d9
MD5 eacfd8a0232d8bad1f7813452900b04a
BLAKE2b-256 ddd5869ca96bdddeb5853e4553366057e9770fdc7fc66c0eeec1c16051be9b4e

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