diff options
author | Lukas Metzger | 2020-06-10 20:43:25 +0200 |
---|---|---|
committer | Lukas Metzger | 2020-06-10 20:43:25 +0200 |
commit | 8421aa6a31b8b41a203b4550c0bc01cc3629f68b (patch) | |
tree | fb7953e192d42743677b477af5cecf16e52e6923 /db.py | |
parent | Moved import files to subfolder (diff) | |
parent | Added minimal date for locations, machines and vms (diff) | |
download | bwlp-statistics-8421aa6a31b8b41a203b4550c0bc01cc3629f68b.tar.gz bwlp-statistics-8421aa6a31b8b41a203b4550c0bc01cc3629f68b.tar.xz bwlp-statistics-8421aa6a31b8b41a203b4550c0bc01cc3629f68b.zip |
Merge remote-tracking branch 'dash/master'
Diffstat (limited to 'db.py')
-rw-r--r-- | db.py | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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() + + + + + |