DatabaseBase¶
Low-level SQLite infrastructure layer responsible for:
- database initialization
- connection creation
- SQLite configuration
- WAL setup
- foreign key enforcement
backend.database.infrastructure.base.DatabaseBase ¶
Infrastructure layer for SQLite access Handles: - Database file creation - connection management
Class Attributes
_db_path (Path): Filesystem path where the database is supposed to be.
get_connection
classmethod
¶
get_connection()
Creates and returns a new SQLite connection.
- Enables foreign key constraints.
- Caller is responsible for closing the connection.
Raises:
| Type | Description |
|---|---|
AssertionError
|
If there's an attempt to make connection |
:return: connection to database :rtype: sqlite3.Connection
initialize_database
classmethod
¶
initialize_database()
Explicitly initialize the database Must be called at application startup