summaryrefslogtreecommitdiff
path: root/f1elo/db.py
diff options
context:
space:
mode:
Diffstat (limited to 'f1elo/db.py')
-rw-r--r--f1elo/db.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/f1elo/db.py b/f1elo/db.py
index 49ccc3d..dc40ba1 100644
--- a/f1elo/db.py
+++ b/f1elo/db.py
@@ -1,16 +1,15 @@
-import __main__
+import json
from os import path
+import __main__
+from f1elo.model import Driver
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
-import json
-
config = json.load(open(path.dirname(__main__.__file__) + '/config/db.json'))
engine = create_engine("mysql://{0[user]}:{0[pass]}@{0[host]}/{0[db]}?charset=utf8".format(config))
Session = sessionmaker(bind=engine)
-from f1elo.model import Driver
def find_driver(name, country, session):
driver = session.query(Driver).filter(Driver.driver==name).first()
@@ -22,4 +21,3 @@ def find_driver(name, country, session):
driver.country = country
session.add(driver)
return driver
-