Close the persistent connection. Subsequent ops will raise. Performs a WAL checkpoint before closing so that all committed data is flushed from the WAL file into the main ``.db`` file. This ensures external tools (DB browsers, backup scripts) see complete data withou
(self)
| 278 | |
| 279 | # Lifecycle |
| 280 | def close(self) -> None: |
| 281 | """Close the persistent connection. Subsequent ops will raise. |
| 282 | |
| 283 | Performs a WAL checkpoint before closing so that all committed |
| 284 | data is flushed from the WAL file into the main ``.db`` file. |
| 285 | This ensures external tools (DB browsers, backup scripts) see |
| 286 | complete data without needing to understand SQLite WAL mode. |
| 287 | """ |
| 288 | if self._closed: |
| 289 | return |
| 290 | self._closed = True |
| 291 | try: |
| 292 | # Flush WAL → main DB so external readers see all data |
| 293 | self._conn.execute("PRAGMA wal_checkpoint(TRUNCATE)") |
| 294 | self._conn.close() |
| 295 | except Exception: |
| 296 | pass |
| 297 | logger.debug("SkillStore closed (WAL checkpointed)") |
| 298 | |
| 299 | async def __aenter__(self): |
| 300 | return self |
no test coverage detected