arista.db.connection
Open a SQLite connection with the project conventions enabled.
The pragmas applied here are:
foreign_keys = ON— schema enforces FK constraints; without this every CHECK / FK inarista.db.schemabecomes silent metadata.journal_mode = WAL— write-ahead logging, gives concurrent reads during bulk insert and is cheap to enable per-connection.
The context manager closes the connection deterministically so the caller doesn’t have to remember.
Functions
|
Context manager around |
|
Return the canonical DB path per the documented resolution order. |
- arista.db.connection.open_db(path, *, create_parents=True, timeout=30.0)[source]
Context manager around
sqlite3.connect()with FK pragma.- Parameters:
path (str | Path) – Database file path. Created on first connect if absent.
create_parents (bool) –
True(default) creates the parent directory tree if it does not exist — convenient for the/mnt/data/arista/arista.dbcase where the lab datadrive mount-point exists but the project subdirectory may not.timeout (float) – SQLite lock-wait timeout in seconds.
- Yields:
An open
sqlite3.Connectionwith foreign-key enforcement on and the WAL journal mode active.- Return type: