N
N
Neonoviiwolf2017-09-11 22:16:14
SQLite
Neonoviiwolf, 2017-09-11 22:16:14

Sqlite VACUUM is a bug?

Kind
Prompt, in a DB records often appear and are deleted, read here that it is necessary to write still the VACUUM command. How to write? if just

vacuum;
, then the error is:
cannot VACUUM from within a transaction:

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
CodeNull, 2019-07-26
@CodeNull

Faced a similar problem. It only occurred when I ran VACUUM along with other commands, like so:

self.db.execute("DELETE FROM %s" % table_name)
self.db.execute("REINDEX %s" % table_name)
self.db.execute("VACUUM")        
self.db.commit()

I solved the problem by adding a separate commit for the vacuum:
self.db.execute("DELETE FROM %s" % table_name)
self.db.execute("REINDEX %s" % table_name)
self.db.commit()
self.db.execute("VACUUM")        
self.db.commit()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question