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 <[email protected]> wrote:
> On Tue, Feb 12, 2013 at 11:38 AM, Dhruv Baldawa <[email protected]
> >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
> [email protected]
> http://mail.python.org/mailman/listinfo/bangpypers
>
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers