Then I guess you are doing it the wrong way. You should only have a single session object (unless working with multiple databases simultaneously). The object should be binded with whatever connection is required.
if PRODUCTION: engine = create_engine(...) else: engine = create_engine(...) session = sessionmaker(bind=engine) then import session from whichever module you have added the above code. I don't know how you are doing the model-based queries, if you have someother way of querying models you can follow that, the concept and method still remains the same. Configurations can be controlled by an optional command-line argument or environment variable or a flag, its upto you. I run 4 different configurations for my app using command-line arguments. -- Dhruv Baldawa (http://www.dhruvb.com) On Tue, Feb 12, 2013 at 12:05 PM, Sriram Karra <karra....@gmail.com> wrote: > On Tue, Feb 12, 2013 at 11:38 AM, Dhruv Baldawa <dhruvbald...@gmail.com > >wrote: > > > try session.query(Consultation).filter_by(), sorry I am actually used to > > using the above specified syntax because I usually use Flask-SQLAlchemy. > > > Oh, well. the session object is not available inside Consultation class. > And as I mentioned I have two session objects of which one is live at any > given time... > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers