most simply just like this: tables = [tbl_a, tbl_b, tbl_c] join = tables.pop(0) for table in tables: join = join.outerjoin(table) sql = join.select()
On Oct 16, 2013, at 10:17 PM, tiadobatima <gbara...@gmail.com> wrote: > Hello there... > > > > however, if you want to chain the joins themselves together, you > > probably want to construct the Join object ahead of time > > I was looking for examples on how to do this but I couldn't find it. I tried > a few variations of this: > > # tbl_a, tbl_b, and tbl_c are Table objects > tables = [tbl_a] > chained_joins = tbl_a > collections = [tbl_b, tbl_c] > for tbl in collections: > tables.append(tbl) > chained_joins.outerjoin(tbl) > sql = select(tables).select_from(chained_joins) > > Any hints are appreciated :) > > Thanks! > g. > > On Friday, 6 April 2007 13:04:40 UTC-7, Michael Bayer wrote: > the select object supports an append_from() method. > and add it > to the select via append_from() (or create the select by calling the > select() method off the Join itself) once its complete. > > > On Apr 6, 2007, at 3:52 PM, vkuznet wrote: > > > > > Hi, > > is there are any way to add additional joins to a given select object? > > > > My problem is the following, I need to join the same table multiple > > times. How many times I don't know in advance and in addition I need > > to apply where clause while adding this join. > > > > Thanks, > > Valentin. > > > > > > > > > > > > > > -- > 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.
signature.asc
Description: Message signed with OpenPGP using GPGMail