Il giorno martedì 26 novembre 2013 02:52:44 UTC+1, Michael Bayer ha scritto: > > > not totally sure what you’re going for here as I think you’re looking at > the problem using a different vocabulary. From the query you have at the > bottom, it appears you’d want this: > > for teacher in > session.query(Teacher).join(Teacher.aula).filter(Aula.nr_aula=='B2'): > print > teacher.id<http://www.google.com/url?q=http%3A%2F%2Fteacher.id&sa=D&sntz=1&usg=AFQjCNEs1_ZO8WE1Ba2Zrw_NXDjoMY4TtA>, > > teacher.name<http://www.google.com/url?q=http%3A%2F%2Fteacher.name&sa=D&sntz=1&usg=AFQjCNGhjOKO2VNSD84vmMRLffqHgdHLAA> > for aula in teacher.aula: > print aula.nr_aula > > overall the best approach is to figure out what SQL represents the query > you’re trying to do, then we can express that using a Query. >
Thank's a lot Michael, this make what I need, finds only the teacher which do a lesson in aula B2. The script I wrote was returning to me every teacher stored into the table. I appreciated your patience. : ) I'm not a guru in SQL, I'm sorry, so, writing a complex join query as this (just for me!) it's impossible. I will test it inside my my true work in python. Best regards. Luca -- 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.