summaryrefslogtreecommitdiff
path: root/ausbutler/db.py
diff options
context:
space:
mode:
Diffstat (limited to 'ausbutler/db.py')
-rw-r--r--ausbutler/db.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/ausbutler/db.py b/ausbutler/db.py
new file mode 100644
index 0000000..c813b58
--- /dev/null
+++ b/ausbutler/db.py
@@ -0,0 +1,13 @@
+import json
+from os import path
+
+import __main__
+from sqlalchemy import create_engine, event
+from sqlalchemy.orm import sessionmaker
+
+config = json.load(
+ open(path.join(path.dirname(__main__.__file__), 'config', 'db.json')))
+engine = create_engine(
+ "mysql://{0[user]}:{0[pass]}@{0[host]}/{0[db]}".format(config))
+
+Session = sessionmaker(bind=engine)