Implement method to close database connections, fixes #246.
This commit is contained in:
parent
00d2279abf
commit
d0c4e9fcc7
@ -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."""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user