diff options
Diffstat (limited to 'app/python/rcal/db.py')
-rw-r--r-- | app/python/rcal/db.py | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/app/python/rcal/db.py b/app/python/rcal/db.py deleted file mode 100644 index 7e892a1..0000000 --- a/app/python/rcal/db.py +++ /dev/null @@ -1,34 +0,0 @@ -import json -from os import path - -import sqlalchemy.engine.url as url -from sqlalchemy import create_engine -from sqlalchemy.orm import sessionmaker - - -class Session(object): - - engine = None - - def __init__(self): - config = json.load( - open(path.join(path.dirname( - path.realpath(__file__)), '..', 'config', 'db.json'))) - db_str = url.URL( - drivername=config['type'], - host=config['host'], - username=config['user'], - password=config['pass'], - database=config['name'], - query={'charset': config['cset']} - ) - self.engine = create_engine(db_str, encoding=config['cset']) - - def get_maker(self): - return sessionmaker(bind=self.engine) - - @staticmethod - def create(): - session = Session() - maker = session.get_maker() - return maker() |