Get a new database connection with WAL mode and busy timeout.
(self)
| 38 | self._init_db() |
| 39 | |
| 40 | def _get_connection(self) -> sqlite3.Connection: |
| 41 | """Get a new database connection with WAL mode and busy timeout.""" |
| 42 | conn = sqlite3.connect(str(self.db_path), timeout=10.0) |
| 43 | conn.execute("PRAGMA journal_mode=WAL") |
| 44 | conn.execute("PRAGMA busy_timeout=5000") |
| 45 | return conn |
| 46 | |
| 47 | def _init_db(self) -> None: |
| 48 | """Initialize database schema.""" |