db.close() method, closes #504

This commit is contained in:
Simon Willison 2022-10-25 13:57:43 -07:00
commit 05e2bb85fc
2 changed files with 18 additions and 0 deletions

View file

@ -336,6 +336,10 @@ class Database:
self._registered_functions: set = set()
self.use_counts_table = use_counts_table
def close(self):
"Close the SQLite connection, and the underlying database file"
self.conn.close()
@contextlib.contextmanager
def tracer(self, tracer: Callable = None):
"""