summaryrefslogtreecommitdiff
path: root/f1elo
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2014-10-17 17:09:35 +0200
committeremkael <emkael@tlen.pl>2014-10-17 17:09:35 +0200
commit07aedcdea97c01c5f1a1f3bc8d9f60a8516b42bf (patch)
treee2c05f18bd7ea08deba890ef38a8a322b5bc4e82 /f1elo
parentda87925da621f45ed72d8e3aa7b79d3d8eb9a0ca (diff)
* SQLite support + config examples
Diffstat (limited to 'f1elo')
-rw-r--r--f1elo/db.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/f1elo/db.py b/f1elo/db.py
index cd7c4ac..8ecb0ac 100644
--- a/f1elo/db.py
+++ b/f1elo/db.py
@@ -7,7 +7,10 @@ from sqlalchemy import create_engine
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]}?charset=utf8".format(config))
+if config['engine'] == 'mysql':
+ engine = create_engine("mysql://{0[user]}:{0[pass]}@{0[host]}/{0[db]}?charset=utf8".format(config))
+else:
+ engine = create_engine("sqlite:///{0[file]}".format(config))
Session = sessionmaker(bind=engine)
def find_driver(name, country, session):