Maybe when calling .vacuum() and other DB-level write-lock operations sqlite_utils could guard against this error message by automatically committing first?
46 db["media"].optimize() # type: ignore
---> 47 db.vacuum()
File ~/.local/lib/python3.10/site-packages/sqlite_utils/db.py:1047, in Database.vacuum(self)
1045 def vacuum(self):
1046 "Run a SQLite ``VACUUM`` against the database."
-> 1047 self.execute("VACUUM;")
File ~/.local/lib/python3.10/site-packages/sqlite_utils/db.py:470, in Database.execute(self, sql, parameters)
468 return self.conn.execute(sql, parameters)
469 else:
--> 470 return self.conn.execute(sql)
OperationalError: cannot VACUUM from within a transaction
It might also be nice to add a sentence or two about how transactions are committed on the docs page. When I was swapping out my sqlite3 code for this library it was nice that everything was pretty much drop-in but I was/am unsure what to do about the places I explicitly call .commit() in my code
Related to #121
Maybe when calling
.vacuum()and other DB-level write-lock operationssqlite_utilscould guard against this error message by automatically committing first?It might also be nice to add a sentence or two about how transactions are committed on the docs page. When I was swapping out my sqlite3 code for this library it was nice that everything was pretty much drop-in but I was/am unsure what to do about the places I explicitly call
.commit()in my codeRelated to #121