Oh, forgot to mention versions SA @ 0.5.6 Python 2.5
On Apr 6, 11:08 am, mozillalives <[email protected]> wrote: > I'm getting the following error when I attempt to run session.query() > with a declarative base object > > UnboundExecutionError: Parent instance <Blah> is not bound to a > Session; lazy load operation of attribute 'attribute' cannot proceed > > But why? `session` is a brand new session I've just started, another > session (I'm creating multiple sessions to different databases) is > used just fine (selects, inserts, and updates running through that > one). Any ideas what I might be missing? > > Here's (basically) where it happens > > from sqlalchemy import orm > session = sessionmaker(bind=engine) > sess = session() > ids = ['1234'] > try: > query = session.query(Blah).select_from(orm.join(Blah, > BlahAttribute)) > if len(ids): > query = query.filter(BlahAttribute.item_id.in_(ids)) > return query.all() > finally: > session.close() > > Blah and BlahAttribute both inherit from a declarative_base object > that is bound to their engine. > > Any help is appreciated. Thanks. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
