arista.db.schema
SQLite schema for the arista calcium-imaging corpus.
Functions
|
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
CREATEusesIF NOT EXISTSso re-running against an already-populated database is a no-op. Foreign-key enforcement is enabled viaPRAGMA.Tables and the
v_recordingsview are applied in oneexecutescriptcall (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 singleCREATE INDEXon 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.dbor: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).Trueforces the bar on;Falseforces it off.
- Return type:
None