summaryrefslogtreecommitdiff
path: root/rcal/db.py
blob: 3e74c4e0dcdd612db5ed52616d5d695ce90161dc (plain)
1
2
3
4
5
6
7
8
9
10
11
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import json, __main__
from os import path

config = json.load(
    open(path.join(path.dirname(__main__.__file__), 'conf', 'db.json')))
engine = create_engine(
    "{0[type]}://{0[user]}:{0[pass]}@{0[host]}/{0[name]}?{0[opts]}".format(config))

Session = sessionmaker(bind=engine)