Add ability to compact the database with VACUUM
This commit is contained in:
parent
27ba33959c
commit
7548f33de4
3 changed files with 69 additions and 16 deletions
|
|
@ -464,6 +464,16 @@ class DBManager:
|
|||
else:
|
||||
raise ValueError(f"Unsupported extension: {ext}")
|
||||
|
||||
def compact(self) -> None:
|
||||
"""
|
||||
Runs VACUUM on the db.
|
||||
"""
|
||||
try:
|
||||
cur = self.conn.cursor()
|
||||
cur.execute(f"VACUUM")
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
def close(self) -> None:
|
||||
if self.conn is not None:
|
||||
self.conn.close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue