Re: New SQLAlchemy session created when referenced in views package

2012-09-05 Thread Michael Merickel
It appears from your example code as if you're using the session from module-scope. This is bad practice because you can't ensure that your initialize_sql() function has executed before that code is run (when the module is imported). On Wed, Sep 5, 2012 at 3:44 PM, Danny Im wrote: > Hi, > > I hav

Re: New SQLAlchemy session created when referenced in views package

2012-09-05 Thread Jonathan Vanasco
scoped_session returns a session, so to me i see: /app/models.py: creates DBSession instance via scoped_session initialize_sql initializes it /app/views / etc : imports the DBSession from /app/models, then calls it? i think that's where an issue may be. have you looked into the SqlAH

New SQLAlchemy session created when referenced in views package

2012-09-05 Thread Danny Im
Hi, I have an issue where if I import a sqlalchemy session and try issuing queries with it I'll get this error: UnboundExecutionError: Could not locate a bind configured on mapper Mapper|MyModel|models, SQL expression or this Session This only happens from within a package within the applicati