Key-Value DB API on the filesystem
Project description
Kv Fs
Simple Key-Value DB implementation on the filesystem
Usage
-
Predefined formats
from kv.fs.json import json_api api = json_api('base_path') api.insert('greetings/hello', dict(hello='world')) # saves onto 'base_path/greetings/hello.json' api.read('greetings/hello') # Right(value=dict(hello='world'))
-
Or build your own:
from kv.fs import FilesystemKV from kv.api.errors import InvalidData import haskellian.either as E import json def parse(x: bytes) -> E.Either[InvalidData, Any]: try: return E.Right(json.loads(x)) except json.decoder.JSONDecodeError as e: return E.Left(InvalidData(e)) api = FilesystemKV(base_path='data', extension='.json', parse=parse, dump=json.dumps)
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
kv_fs-0.1.6.tar.gz
(4.8 kB
view hashes)
Built Distribution
kv_fs-0.1.6-py3-none-any.whl
(5.7 kB
view hashes)