Jess,

Thanks for posting the actual class :)  Just reading the description
"use contains_eager" didn't tell me enough about how to make it
happen.

Cheers,

Gregg

On Thu, Jul 16, 2009 at 12:54 PM, jess<[email protected]> wrote:
>
> I believe that I asked Michael a similar question, in a different way,
> a few days ago.
>
> The answer was to use "contains_eager".  I used something like the
> following and it worked great to query what the membership of a group
> was at a specific time.  The two tables remain simple, related by a
> group_id and the query is dynamic according to the time that you are
> interested in
>
>        map = mapper( Group,
>                      group_table,
>                      properties=dict( members=relation( Member,
> backref='group' ) )
>                      )
>
>        statement = names.outerjoin(members).select(
>            and_( Member.start <= reftime, Member.stop >= reftime
>            ).apply_labels()
>
>        query = session.query(Group).options( contains_eager
> ('members') )
>        query = query.from_statement(statement)
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to