Skip to content

Commit 838bde3

Browse files
committedFeb 16, 2018
[dbmanager] Workaround Python error when vacuuming spatialite table
Workaround https://bugs.python.org/issue28518 Fixes #18079
1 parent d380c61 commit 838bde3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎python/plugins/db_manager/db_plugins/spatialite/connector.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,11 @@ def createSpatialView(self, view, query):
555555

556556
def runVacuum(self):
557557
""" run vacuum on the db """
558-
self._execute_and_commit("VACUUM")
558+
# Workaround http://bugs.python.org/issue28518
559+
self.connection.isolation_level = None
560+
c = self._get_cursor()
561+
c.execute('VACUUM')
562+
self.connection.isolation_level = '' # reset to default isolation
559563

560564
def addTableColumn(self, table, field_def):
561565
""" add a column to table """

0 commit comments

Comments
 (0)
Please sign in to comment.