From 5a353b3ecee98ce30e38c27ab1b33607d70f8956 Mon Sep 17 00:00:00 2001 From: maaa Date: Wed, 2 Aug 2023 21:23:36 +0200 Subject: [PATCH] add vacuum --- vacuum | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 vacuum diff --git a/vacuum b/vacuum new file mode 100644 index 0000000..f7d4c70 --- /dev/null +++ b/vacuum @@ -0,0 +1,18 @@ +#!/usr/bin/python3 +import sqlite3 +import os + +def get_db_connection(): + conn = sqlite3.connect("database.db") + conn.row_factory = sqlite3.Row + return conn + +if os.path.exists("database.db"): + print("vacuuming..") + conn = get_db_connection() + conn.execute("VACUUM") + conn.commit() + conn.close() + print("success") +else: + print("database not found") \ No newline at end of file