> ctx.current.query(B).filter_by(A.c.name.like('%foo%'))

added the join manually:

ctx.current.query(B).filter(B.c.xid ==
A.c.xid).filter_by(A.c.name.like('%foo%'))

m


On Apr 24, 2:33 pm, Matt <[EMAIL PROTECTED]> wrote:
> I have 2 classes A and B which are mapped each to their own table.
> There is a foreign key which defines a one to many relationship from A
> to B.
>
> Is it possible to query B, but filter on an attribute of A?
>
> ctx.current.query(B).filter_by(A.c.name.like('%foo%'))
>
> This seems to work, but the query to the DB seems to be missing the
> join between the tables for A and B...
>
> Sqlalchemy 0.3 BTW...
>
> thx
>
> Matt
--~--~---------~--~----~------------~-------~--~----~
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