summaryrefslogtreecommitdiffstats
path: root/dash/db.py
diff options
context:
space:
mode:
authorLukas Metzger2020-06-10 20:44:19 +0200
committerLukas Metzger2020-06-10 20:44:19 +0200
commit5c44f6a41885c439e526dc3c022ff7daaa43c2c6 (patch)
tree117c9b6470d3b53e8a3614dd1a52c5951db03fa9 /dash/db.py
parentMerge remote-tracking branch 'dash/master' (diff)
downloadbwlp-statistics-5c44f6a41885c439e526dc3c022ff7daaa43c2c6.tar.gz
bwlp-statistics-5c44f6a41885c439e526dc3c022ff7daaa43c2c6.tar.xz
bwlp-statistics-5c44f6a41885c439e526dc3c022ff7daaa43c2c6.zip
Move dashboard to subfolder
Diffstat (limited to 'dash/db.py')
-rw-r--r--dash/db.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/dash/db.py b/dash/db.py
new file mode 100644
index 0000000..b417cfd
--- /dev/null
+++ b/dash/db.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+
+import pymysql
+import configparser
+
+c = configparser.ConfigParser()
+c.read('config.ini')
+
+def getConnection():
+ db = pymysql.connect(c.get('db', 'host'), c.get('db', 'username'), c.get('db', 'password'), c.get('db', 'name'), cursorclass=pymysql.cursors.DictCursor)
+ return db
+
+def closeConnection(db):
+ db.commit()
+ db.close()
+
+
+
+
+