Arno wrote: > > I am trying to do an left outer join from two sql queries but cannot > find > how to join on multiple columns. > I am using the outerjoin function. > The only way I found was to use a text clause for the on clause. > Basically, I have: > q1 = create_sql1().alias('qleft') > q2 = create_sql2().alias('qright') > oj = outerjoin(q1,q2,text('(qleft.a,qleft.b)=(qright.a,qright.b)')) > > I am using a postgresql database. > Is there another way to do it to avoid the text clause?
use and_() and equate the two pairs separately, and_(lft.c.a==rgt.c.a, lft.c.b==rgt.c.b) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---