Implement method to close database connections, fixes #246.

This commit is contained in:
Friedrich Lindenberg 2020-01-11 13:16:30 +01:00
parent 00d2279abf
commit d0c4e9fcc7

View File

@ -136,6 +136,12 @@ class Database(object):
else: else:
self.rollback() self.rollback()
def close(self):
"""Close database connections. Makes this object unusable."""
self.engine.dispose()
self._tables = {}
self.engine = None
@property @property
def tables(self): def tables(self):
"""Get a listing of all tables that exist in the database.""" """Get a listing of all tables that exist in the database."""