Permalink
Browse files

orm now works.

  • Loading branch information...
1 parent 436cbf7 commit 901c37054604bfe9a084041d26645268e7b2bbca @alswl committed Jan 7, 2012
Showing with 23 additions and 0 deletions.
  1. +23 −0 config.py
View
@@ -0,0 +1,23 @@
+# coding=utf8
+
+import logging
+import logging.config
+import yaml
+
+from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.orm import scoped_session, sessionmaker
+from sqlalchemy import create_engine
+
+config = yaml.load(open('config.yml', 'r'))
+
+engine = create_engine(config['data'], echo=True) # set data connect string
+
+# SQLAlchemy session manager. Updated by model.init_model()
+Session = scoped_session(sessionmaker())
+Session.configure(bind=engine)
+session = Session()
+
+# The declarative Base
+Base = declarative_base()
+
+logging.config.dictConfig(config['logging'])

0 comments on commit 901c370

Please sign in to comment.