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
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
python_kv-0.1.4.tar.gz
(15.1 kB
view details)
Built Distribution
python_kv-0.1.4-py3-none-any.whl
(21.8 kB
view details)
File details
Details for the file python_kv-0.1.4.tar.gz
.
File metadata
- Download URL: python_kv-0.1.4.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3006c30a81a1f2f1c298b8f362e8e0e9b365c5d5b2b2a7de476e95c4c2a4e91 |
|
MD5 | b363572becd0a4c5fdfedebfdd1d4619 |
|
BLAKE2b-256 | 00a5e626f312ecaa391f795e1aa021f11051364d338e3e83a420324015fb4d86 |
File details
Details for the file python_kv-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: python_kv-0.1.4-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5bec4f926df6dd6c312a0cda03695c5a988fdc8d23cc17a19c03bd08fd1e0e0 |
|
MD5 | 78234969f2b736309073cdf34c6dbd00 |
|
BLAKE2b-256 | 2e6c4f6a83c92d59c3dd44dbf608f22976bdffc401e69de355008d7191f092b7 |