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:
parent
0122e8cc00
commit
a4e41c09b7
|
@ -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
|
||||
|
|
|
@ -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_):
|
||||
|
|
Loading…
Reference in New Issue