On Jul 5, 2011, at 4:25 AM, Michael Tils wrote: > Hello Michael, > > thanks a lot again, sorry for not extracting the right parts...I'll > try to do that better next time. > > >> bc1 = aliased(BuildingCondition) >> bc2 = aliased(BuildingCondition) >> lc1 = aliased(LookupSubclassOne) >> lc2 = aliased(LookupSubclassTwo) >> >> query(Building).\ >> join(bc1, Building.condition).\ >> join(lc1, bc1.rating).\ >> join(bc2, Building.condition).\ >> join(lc2, bc2.care_level).\ >> filter(...) > > (with tuples on 0.6.8) works!!! Yippieh! > > I know, i ask much...but I have two remaining questions: > > 1. Why do I have to make two joins on a table, which I need only once? > Two joins to Building.condition, although I need only aliased > versiones of the lookup table and in sql I need only one join > to Building.condition
ah good point. yes you only need BuildingCondition once really query(Building).join(Building.condition).join(lc1, Building.rating).join(lc2, Building.care_level) should work too. > > 2. The workinig method produces two times the polymorphic_identity on > the second join: > It looks like this: it seems like you have "lookup_category_id=6" in your primary join conditions. relationship() when presented with A->C, where C is a single table subclass of B, will always stick the " discriminator IN (C, <descendants of C>)" on the end of a JOIN condition. -- 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 sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.