On Sep 19, 2013, at 3:07 PM, Michael Bayer <mike...@zzzcomputing.com> wrote: > > On Sep 19, 2013, at 2:46 PM, Nathan Mailg <nathanma...@gmail.com> wrote: > >> c = aliased(City) >> q2 = s.query(q1).\ >> join(Appl.city).\ >> join(c, Appl.city).\ >> order_by(q1.c.lastname, q1.c.firstname) > > why don't you join on the Column objects present rather than relying on the > relationship?
Sorry, I don't know. I'm sure I'm missing something basic that's obvious to you. :) Do you mean something like this? q2 = s.query(q1).\ join(City, City.id==q1.c.cityid).\ order_by(q1.c.lastname, q1.c.firstname) That's all I've been able to get to work. I think I've been spoiled by relationship() using declarative. :) What I'm trying to get at are the attrs on City, like: # row is KeyedTuple instance for row in q2.all(): # this works print row.lastname # below does not work, # stuck here trying to get at joined City attrs, e.g. City has a "name" attr print row.city.name Sorry for my confusion. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.