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.9.tar.gz
(15.2 kB
view details)
Built Distribution
python_kv-0.1.9-py3-none-any.whl
(21.9 kB
view details)
File details
Details for the file python_kv-0.1.9.tar.gz
.
File metadata
- Download URL: python_kv-0.1.9.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b47d411726bde0a275f3b1dca9c7a49f0debba28bad12da61ee45faecddb791 |
|
MD5 | fa677660c5d0ed8c5ca886ea63c6f6d7 |
|
BLAKE2b-256 | 01cd9a41ed936293f87007fbe7450f58c2986e6a290cb9c53b87052e0ac1307a |
File details
Details for the file python_kv-0.1.9-py3-none-any.whl
.
File metadata
- Download URL: python_kv-0.1.9-py3-none-any.whl
- Upload date:
- Size: 21.9 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 | 0131a75aeb357a4b9701f4b4302bd1c9fd3472f1b4dfa7dd3235db4d9cf5719b |
|
MD5 | 1c814265be45f49ec5fa371ffbb289f1 |
|
BLAKE2b-256 | 8765b7fc65374282ee4364aea21af1b271a950bb079f70c5e803e555b7d9e410 |