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.2.1.tar.gz
(15.8 kB
view details)
Built Distribution
python_kv-0.2.1-py3-none-any.whl
(22.5 kB
view details)
File details
Details for the file python_kv-0.2.1.tar.gz
.
File metadata
- Download URL: python_kv-0.2.1.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7428ff6449a9130796e0be5b72bd9019db3c3fe11ad06e44d288054bda8b6370 |
|
MD5 | 83619d379f8bf8904e222a2413a5ad13 |
|
BLAKE2b-256 | 5d39d10f87b549d36c1d374c5d5e246b180e1f55dc5c240b220b1d72673f8faf |
File details
Details for the file python_kv-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: python_kv-0.2.1-py3-none-any.whl
- Upload date:
- Size: 22.5 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 | 386f8f050b7c57d66d3ec4e1720a0046b1e62fd7217d5979703b9a4b5f11599f |
|
MD5 | 724849a13e6d39e6fb6ba0c4cca9ee94 |
|
BLAKE2b-256 | 3b5ad37b0121cd33e26d17713f1a49bb2c2d31f2a66618775a796aeebff1ba84 |