A couple of comments that I hope might help.

The rows is a dict so if you apply the keys() function you get a list
of keys or values returns a list of values under the keys.

rows = big_hairy_select_with_joins

for row in rows:
  for table in row.values()
    for field in table.values()

which is iterated over to pull out the value then repeat for the next
level down in the data structure. If I read you correctly I think you
want to generically process the result no matter what query went in?
SQLTABLE must do something like this to pretty print the rows from a
select.

The reason for the hierarchy in the row dict when a join is involved
is so you can tell which table the column came from and there are name
collisions across tables e.g. every table has an id column.

The DAL also has a way to convert rows to a list of the values

rows_list = (big_hairy_select_with_joins).select().as_list()

So now the query result is processed generically with no prior
knowledge of the table or column names?

Is that closer to what you want?


On Oct 23, 9:08 pm, BigBaaadBob <bigbaaad...@gmail.com> wrote:
> I must be expressing myself poorly.  I'm saying that if the dal (and
> sql) Row class had a method like this:
>
> def column(self, colname):
>     (table, field) = colname.split('.')
>     return self[table][field]
>
> I could do this (which is what jqGrid wants):
>
> results = list()
> for row in big_long_hairy_select_with_joins_and_stuff
>     vals=list()
>     for f in rows.colnames:
>         vals.append(row.column(f))
>     results.append(dict(id=row.column(rows.colnames[0]),cell=vals))
>
> return dict(results=results)
>
> Am I alone in thinking this is something the Row class should know how
> to do, or is there some trivial way of doing this already?
>
> It seems weird that no one else has run into this problem...

Reply via email to