summaryrefslogtreecommitdiff
path: root/ausbutler/db.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-05-04 23:19:14 +0200
committeremkael <emkael@tlen.pl>2017-05-09 02:51:36 +0200
commit9ad496966ab94c37cbf4208ec1fd39257cb60410 (patch)
tree4bbb7bce3d4eb598f723e76211c9f29c5feb0635 /ausbutler/db.py
parent557569d76e9ccaaef9df4b6d49cb14a55b5e4980 (diff)
Verbose DB name read
Diffstat (limited to 'ausbutler/db.py')
-rw-r--r--ausbutler/db.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/ausbutler/db.py b/ausbutler/db.py
index 94f07de..353c9e0 100644
--- a/ausbutler/db.py
+++ b/ausbutler/db.py
@@ -4,9 +4,11 @@ from sqlalchemy.orm import sessionmaker
from .config import load_config
-def get_session():
+def get_session(config=None):
+ if config is None:
+ config = load_config('db')
session = sessionmaker(bind=create_engine(
"mysql+mysqlconnector://{0[user]}:{0[pass]}@{0[host]}/{0[db]}?charset=utf8".format(
- load_config('db')
+ config
)))
return session()