summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBotond Hende <nettingman@gmail.com>2024-08-25 21:18:08 +0200
committerBotond Hende <nettingman@gmail.com>2024-08-25 21:18:08 +0200
commita0e04e28bbab7ecc6a0c3b1bee72da303b82aebd (patch)
tree8a8000e514a27280104266c0870dd4d62953aaa2 /modules
parentdbb410dafec593ff8f082c07074fbf8148613d9b (diff)
split code into separate files
Diffstat (limited to 'modules')
-rw-r--r--modules/database.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/database.py b/modules/database.py
new file mode 100644
index 0000000..f75f68e
--- /dev/null
+++ b/modules/database.py
@@ -0,0 +1,12 @@
+import os.path
+import sqlite3
+from pathlib import Path
+from config import Config
+
+db_dir = os.path.dirname(Config.DATABASE_PATH)
+Path(db_dir).mkdir(parents=True, exist_ok=True)
+
+assert sqlite3.threadsafety == 3, "QLite thread safety is not set to 'Serialized'."
+sq_con = sqlite3.connect(Config.DATABASE_PATH)
+
+cursor = sq_con.cursor()