Skip to content

Class tigrbl.orm.mixins.bootstrappable.Bootstrappable

tigrbl.orm.mixins.bootstrappable.Bootstrappable

Seed DEFAULT_ROWS for this mapped class only with zero magic.

Rules
  • Insert ONLY keys present on this class's mapped columns.
  • No auto defaults, no timestamp injection, no unique probing.
  • Idempotency only if ALL primary key columns are present in the row.
  • Listener is attached to cls.table (no cross-class/global effects).

DEFAULT_ROWS class-attribute

DEFAULT_ROWS = []

ensure_bootstrapped classmethod

ensure_bootstrapped(db, rows=None)
Source code in tigrbl/orm/mixins/bootstrappable.py
55
56
57
58
59
60
61
@classmethod
def ensure_bootstrapped(
    cls, db: Session, rows: Iterable[dict[str, Any]] | None = None
) -> None:
    rows = cls.DEFAULT_ROWS if rows is None else list(rows)
    if rows:
        cls._insert_rows(db, rows)