SQLiteStorage
Persistent FSM storage with zero infrastructure. v0.5.0
Setup
main.py
from kurigram_addons import KurigramClient, SQLiteStorage
app = KurigramClient(
"my_bot",
bot_token="...",
storage=SQLiteStorage("fsm.db"),
)
app.run()Requires the aiosqlite package: pip install kurigram-addons[sqlite]
Constructor Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
path | str | Path | — | Path to the SQLite database file |
table | str | "fsm_state" | Table name for state records |
cleanup_interval | int | 300 | Seconds between TTL cleanup runs |
Characteristics
- Survives bot restarts — state persists on disk.
compare_and_setis atomic viaBEGIN IMMEDIATEtransactions.increment()is implemented as a single SQLINSERT … ON CONFLICT … DO UPDATE.- No extra infrastructure — just a local file.
- Good for single-process bots. For multi-process deployments, use RedisStorage.
Comparison
| Backend | Persistent | Multi-process | Extra infra |
|---|---|---|---|
MemoryStorage | No | No | None |
SQLiteStorage | Yes | No | None |
RedisStorage | Yes | Yes | Redis |