Easy, Simple and powerful key-value database backed by sqlite3.
- Fast and easy-to-use database
- Simultaneously asynchronous or synchronous calls
- Store any data supported by pickle
- Python3.8+
pip install kvsqlite
From github (dev version)
pip install git+https://github.com/AYMENJD/Kvsqlite
Kvsqlite documentation available at kvsqlite.rtfd.io.
from kvsqlite import Client # For sync version do: from kvsqlite.sync import Client
import asyncio
async def main():
async with Client("kv.sqlite") as db:
key = "123-456-789"
result = await db.set(key, "Hello world. Bye!")
if await db.exists(key):
get_key = await db.get(key)
print(get_key) # Hello world. Bye!
await db.delete(key)
await db.setex(key, 60, "This key has a lifetime of 60 seconds")
print(await db.get(key))
else:
print("Key not found", result)
asyncio.run(main())