ScoloDB
ScoloDB is an async-first SQLite key-value store for bots and small Python services. It stores JSON-compatible values locally, uses SQLite WAL mode, supports TTL, atomic counters, and transactions, and requires no database server.
Installation
pip install ScoloDB
Quick start
import asyncio
from scolodb import ScoloDB
async def main() -> None:
async with ScoloDB('bot.sqlite3') as db:
await db.set('users', '42', {'language': 'ru'})
user = await db.get('users', '42')
print(user['language'])
asyncio.run(main())
A namespace is required for every key. It keeps unrelated data separate without requiring multiple database files.
TTL cache
await db.set('cache', 'weather:moscow', {'temperature': 18}, ttl=300)
weather = await db.get('cache', 'weather:moscow')
Expired values behave as missing and are removed during reads, scans, or purge_expired().
Atomic counters
messages = await db.increment('metrics', 'messages')
increment() is serialised through the database lock, so concurrent asyncio tasks cannot lose updates.
Transactions
async with db.transaction() as transaction:
await transaction.set('order', '42:status', 'paid')
await transaction.set('order', '42:receipt_sent', True)
An exception inside the block rolls back every write from that transaction.
Logging
ScoloDB depends on ScoloLogger for optional structured operation events. It never configures logging automatically. Applications that need diagnostics can configure ScoloLogger themselves:
from scolologger import configure
configure(level='DEBUG')
Stored values and keys are not placed in log events.
Limits
ScoloDB 0.1.0 targets one process and a local SQLite file. It is not a replacement for PostgreSQL, Redis, or a distributed database. Values must be JSON-compatible.
License
MIT.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scolodb-0.1.0.tar.gz.
File metadata
- Download URL: scolodb-0.1.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fdcf9eb6edfb53ff7eece7c0be265d3cee2471cf34a74ace3ead1020cedccd4e
|
|
| MD5 |
e8df64ff294d8e61e4383230e5418ecc
|
|
| BLAKE2b-256 |
3df8ac67dd6ece6b8745156557c0c204b2c074b011b1cc1258879a8838f59cfc
|
File details
Details for the file scolodb-0.1.0-py3-none-any.whl.
File metadata
- Download URL: scolodb-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
195d6dc2481f7374a4b4e1a95c8c544cbd2bca479cfa4dd467d2b95d0e19978b
|
|
| MD5 |
47bca05fc63e91dd90ff505e87e82a0e
|
|
| BLAKE2b-256 |
790d3cc0e33c66b8c9d3c4251e10309fdae21a0c025c874047c7578bb163d53d
|