summaryrefslogtreecommitdiffstats
path: root/dash/db.py
diff options
context:
space:
mode:
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()
+
+
+
+
+