Skip to content

Table

The in-memory collection backing a registered model. Each Table owns its rows, its next auto-increment id, and any hash indexes.

table

Table-level CRUD operations over a storage backend.

Table[T] is bound to a model class and a :class:~tinystore.database.Database. All operations acquire the database-wide write lock (reentrant, so an active transaction is fine) and validate constraints (unique, optimistic concurrency) before writing. Single-op writes are atomic per table file; multi-table all-or-nothing durability arrives with the transaction journal in Phase 5.

Table

Table(database: Database, model_cls: type[T])

Bases: Generic[T]

CRUD interface for a single model.

ensure_created

ensure_created() -> None

Create the table file if missing, with the empty-table skeleton.