Hello! After some research on the *FromClause *object, I have figured out what should I do.
So, my I got my code to work as follows: # Considering the table objects: A, B and C... # I first made a join clase over the A table. *J1 = A.join(A.c.some_col == B.c.some_col)* # The second join is applyed from within the frist join *J2 = J1.join(A.c.other_col == C.c.other_col)* # The select references each table explicitly, and the select_from clause # uses the second join *sel = select([A.c.id,* * B.c.id,* * C.c.id]).\* * select_from(J2)* # And we're done! *connection.execute(sel)* On Friday, November 7, 2014 5:16:36 PM UTC-2, Tiago Guimarães wrote: > > Hi. > > Could anyone help me with "translating" the following SQL to Sqlalchemy > Core? > > SELECT A.id, > B.id, > C.id > FROM A > LEFT OUTER JOIN B > ON B.some_col = A.some_col > LEFT OUTER JOIN C > ON C.other_col = A.other_col > > > The problem I'm facing is that the *Select().select_from(fromclause*) > method only accepts only one *fromclause* object. In my mind, it would be > just nice if *select_from* could accept multiple join objects, as it > seems to happen on the raw SQL exerpt above. > > How would you guys compose this selectable using core? > > Thanks in advance!!! > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
