-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdb.py
22 lines (21 loc) · 816 Bytes
/
db.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""
file: db.py
author: Ben Grawi <[email protected]>
date: October 2013
description: Holds the db connection info
"""
from config import config
import sqlalchemy
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Session = sessionmaker()
engine = sqlalchemy.create_engine(config['db']['type'] + '+' +
config['db']['adapter'] + '://' +
config['db']['username'] + ':' +
config['db']['password'] + '@' +
config['db']['host'] + ':' +
config['db']['port'] + '/' +
config['db']['database'])
Session.configure(bind=engine)
Base = declarative_base()