On 4/7/08, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Apr 7, 2008, at 4:54 PM, Tim Lesher wrote:
> > session
> > .query(Action).filter(Action.task.has(Connection.caller==caller1))
> for this kind of thing, you're joining across three tables, so you can
> put an extra join condition in the has():
>
> filter(Action.task.has(and_(Connection.caller==caller1,
> Task.connection_id==Connection.id)))
>
> or do it with join():
>
>
> query(Action).join('task').filter(Task.has(Connection.caller==caller1))
>
> I have an intuitive sense that there should be some nice syntax to get
> has() and any() to join across more tables but its not occuring to me
> at the moment.
I'm confused -- this sample does correlate actions with tasks, but not
tasks with connections. Intuitively it seems that X.has(Y) should
always add a clause to the the exists for y.y_id = x.y_id. No?
-Jonathan
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---