In your version it implies I know relationships, and I said I don't know them, I auto-load tables and schema. This is the hard part. I don't want to deal with onclause details. Let's say that all tables has ID column and
tableA has id tableB has id and tableA_id (forein key to tableA) tableC has tableB_id (forein key to tableB) what will join do if I specify "a wrong" order tableC.join(tableA).join(tableB) ??? And if I do: sel = tObj.join(tObj2).select(tObj.c.Name) I got the select of all columns from the join, rather then tObj.c.Name, the last one is treated as WHERE clause. On Feb 5, 2:58 pm, [EMAIL PROTECTED] wrote: > i'm not sure if i understand what u want, but u can do nested join( > prev_join, table_next). Also see the full spec of select( > columns_list, whereclause, from_obj_list, order_by, group_by, ....) > > something like > > table_a.join(table_b).join(c).join(d).select([<columns_here>]) > > for the implicit version of join, may do the job if there is only one > obvious relation from table to table. If not, u have to specify > onclauses on each join and use the explicit join(t1,t2,onclause). > > Maybe give some better example (at last 3 tables/columns)? > > > Hi, > > I've trying to solve the following problem. I've given a list of > > tables and list of columns to look at. > > All tables are auto-loaded from DB. So, I don't know a priory (I > > don't want to know) the relationships and table schema. Now, how to > > build a general join among tables and retrieve only the list of > > given columns names. As an example, there is an explicit join call > > and I can do > > > join(tableObj1, tableObj2).select() > > > but selection will be done for all columns and as of my > > understanding join can do only 2 tables. > > > Can it be generalized to a list of tables and can selection be done > > only on given column names? > > > Thanks, > > Valentin. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
