arista.db.schema

SQLite schema for the arista calcium-imaging corpus.

Functions

build_schema(conn, *[, progress])

Apply the full schema to a database connection.

arista.db.schema.build_schema(conn, *, progress=None)[source]

Apply the full schema to a database connection.

Idempotent: every CREATE uses IF NOT EXISTS so re-running against an already-populated database is a no-op. Foreign-key enforcement is enabled via PRAGMA.

Tables and the v_recordings view are applied in one executescript call (cheap regardless of corpus size). Indexes are applied one at a time so a tqdm progress bar can report which index is currently being built — at scale a single CREATE INDEX on a populated table can take seconds to minutes and going silent during that wait makes the run look hung.

Parameters:
  • conn (Connection) – An open SQLite connection (typically to arista.db or :memory: for tests).

  • progress (bool | None) – Controls the index-creation progress bar. None (default) auto-detects: shows when stdout is a TTY, hides otherwise (the typical pytest setup, so test fixtures don’t need to pass anything). True forces the bar on; False forces it off.

Return type:

None