On Oct 10, 2:12 pm, Marco Mariani <[EMAIL PROTECTED]> wrote:
> James Brady ha scritto:
>
> > The problem I'm hitting at the moment is how to properly select simple
> > objects... There seems to be two main approaches, for example:
> > session.query(Ownership).select() or
> > ownership_table.select().execute()
>
> > With the first approach, I get
> > InvalidRequestError: Parent instance <class 'tnf.model.Ownership'> is
> > not bound to a Session, and no contextual session is established; ...
> > which I'm not sure how tackle - there's no mention I can find of when
> > and where create_session should be called...
>
> Did you call assign_mapper on Ownership?
>
> > Can anyone answer these specific questions or point me in the
> > direction of some further documentation?
>
> You should be able to call Ownership.query() just fine, if you have a
> working mapper.

Hi Marco, assign_mapper did help - the relations are now accessible
through my models, and the query syntax is nicer than pure SA as well
in my opinion.

However, I'm using the identity framework (part of TurboGears) which
unfortunately doesn't play nicely with assign_mapper... shame!

James


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to