Skip to content
Snippets Groups Projects
Commit 609bc6b9 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Release SQLite file connection when Database object is deleted

parent 083f2687
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,10 @@ class Database(object):
# opens a session to the database - keep it open until the end
self.connect()
def __del__(self):
"""Releases the opened file descriptor"""
if self.session: self.session.bind.dispose()
def connect(self):
"""Tries connecting or re-connecting to the database"""
if not os.path.exists(SQLITE_FILE):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment