## Store


## store.Store


An open aiosqlite database with WAL, busy_timeout, and a schema applied.


Usage

``` python
store.Store(
    db,
    lock=anyio.Lock(),
)
```


Single-writer: a per-[Store](store.md#athome.store.Store) `anyio.Lock` serializes [execute](tinker-engine.md#athome.train.engine.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](tinker-engine.md#athome.train.engine.execute) retries a bounded number of times on `database is locked` before propagating.


#### Parameter Attributes


`db: aiosqlite.Connection`  

`lock: anyio.Lock = anyio.Lock()`    


#### Methods

| Name | Description |
|----|----|
| [open()](#athome.store.Store.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

``` python
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

``` python
>>> async with Store.open(path, schema=SCHEMA, synchronous="FULL") as store: ...
```
