python 3.6 SQLite compat vacuum in transaction

fixes sqlite3.OperationalError: cannot VACUUM from within a transaction
solution from https://bugs.python.org/issue28518
This commit is contained in:
Eric Le Lay 2017-01-29 16:30:12 +01:00
parent 0122e8cc00
commit a4e41c09b7
2 changed files with 5 additions and 3 deletions

View File

@ -55,9 +55,9 @@ class Database(object):
self.commit()
with self.lock:
cur = self.cursor()
cur.execute("VACUUM")
cur.close()
self.db.isolation_level = None
self.db.execute('VACUUM')
self.db.isolation_level = ''
self._db.close()
self._db = None

View File

@ -66,7 +66,9 @@ class Store(object):
def close(self):
with self.lock:
self.db.isolation_level = None
self.db.execute('VACUUM')
self.db.isolation_level = ''
self.db.close()
def _register(self, class_):