query(X).join(X.all_A.of_type(C)) works but produces a subselect (select all-them-columns ...) which is huge/hard to read. i found that query(X).filter( X.all_A.of_type(C).any()) works too, and the subselect is shorter (select 1 ...).
hmm, might be useful to somehow differ between a join that is there for usage of it's columns and a join that is just for filtering. thanks svil On Wednesday 19 November 2008 01:22:22 Michael Bayer wrote: > technically you'd say query(X).join(X.all_A.as_type(C)) but I don't > know offhand if that use case has been implemented for join() as of > yet. you can of course just say query(X).join((A, A.id==x.aid), > (C, C.id==A.id)) assuming you're on joined table inheritance. all > bets are off for concrete. > > [EMAIL PROTECTED] wrote: > > hi > > > > i have A, B, C,... inheritance, where A points to some X. > > how i query all Xs which are pointed by, say Cs ? > > > > if i put a backref on the reference, > > query(X).join( X.all_A) will give me As Bs Cs everything... > > > > or should that go down to joins? > > > > ciao > > svil --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---