db.connection
SQLite connection helpers for the webapp persistence layer.
This module owns connection-level concerns only: opening the SQLite database, creating parent directories, and applying connection PRAGMA defaults.
Functions
|
Open a SQLite connection configured for webapp usage. |
Module Contents
- db.connection.connect_database(db_path)
Open a SQLite connection configured for webapp usage.
- Parameters:
db_path (pathlib.Path) – Filesystem path to the SQLite database file.
- Returns:
Open
sqlite3.Connectionwithsqlite3.Rowrow factory.- Return type:
Notes
The connection applies SQLite PRAGMAs tuned for this webapp’s read-heavy access pattern:
foreign_keys = ONto enforce package/table relationships.journal_mode = WALto improve concurrent read behavior.synchronous = NORMALto balance durability and write latency.busy_timeout = 5000to reduce transient lock failures.