Store
store.Store
An open aiosqlite database with WAL, busy_timeout, and a schema applied.
Usage
store.Store(
db,
lock=anyio.Lock(),
)Single-writer: a per-Store anyio.Lock serializes execute so a write and its commit land as one unit and no other task’s commit flushes a partial write. Beyond the connection busy_timeout, execute retries a bounded number of times on database is locked before propagating.
Parameter Attributes
db: aiosqlite.Connectionlock: anyio.Lock = anyio.Lock()
Methods
| Name | Description |
|---|---|
| open() |
Open path with WAL, busy_timeout_ms, synchronous, and schema applied.
|
open()
Open path with WAL, busy_timeout_ms, synchronous, and schema applied.
Usage
open(path, *, schema, busy_timeout_ms=5000, synchronous="NORMAL")Pass synchronous="FULL" when an already-committed transaction must survive a power loss or OS crash — under WAL the "NORMAL" default is corruption-safe but can roll back the most recent commits in that case, so durability-critical writers (financial records, ledgers) want "FULL" and caches keep the faster default.
Example
>>> async with Store.open(path, schema=SCHEMA, synchronous="FULL") as store: ...