Key-Value interface over SQLite. Supports any datatype, including JSON and BLOB
Project description
Sqlite Kv
Async Key-Value interface over SQLite. Supports any datatype, including JSON and BLOB
Usage
Simplest is to use the
SQKliteKV
api
-
JSON documents
from sqlite_kv import SQLiteKV api = await SQLiteKV.documents(db_path='mydb.sqlite', table='myjsons') # or, if you're sure the DB file already exists api = SQLiteKV.documents(db_path='mydb.sqlite', table='myjsons', create=False) await api.upsert('my-doc', dict(hello='world')) await api.read('my-doc') # dict(hello='world')
-
BLOBs
from sqlite_kv import SQLiteKV api = await SQLiteKV.blobs(db_path='mydb.sqlite', table='myblobs') await api.upsert('my-image', b'<super big image>') await api.read('my-image') # b'...'
-
Any custom datatype (e.g. JSON, but manually)
import json from sqlite_kv import SQLiteKV api = await SQLiteKV.new( db_path='mydb.sqlite', table='my-jsons', dtype='JSON', parse=json.loads, dump=json.dumps ) await api.upsert('my-image', dict(hello='world')) await api.read('my-image') # dict(hello='world')
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-sqlite-sync-0.1.0.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for kv_sqlite_sync-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4294205768d8e2de12d940058bd51d4f2a72afa19415042c47e8c573cc0ef22 |
|
MD5 | d435b0cc825cae78ed373c6321064793 |
|
BLAKE2b-256 | 0c296d6efba60a84d47ca9b697df4fa83f6aa32023e68d63c93569dd49805c8a |