DenesL's method should work as long as you have as_dict=False (the default) 
in your call to executesql().

Anthony

On Friday, November 18, 2011 3:33:05 PM UTC-5, David Watson wrote:
>
> This produces a table with a single column and the rows consisting of 
> what should have been the header columns followed by the body columns 
> manifested as rows also. 
>
> On Nov 17, 10:25 am, DenesL <dene...@yahoo.ca> wrote: 
> > Why not just: 
> > 
> > table = TABLE(THEAD(columns), TBODY(raw_rows)) 
> > 
> > On Nov 16, 3:43 pm, David Watson <davidth...@gmail.com> wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > Does anybody have example code showing how to package the return from 
> > > executesql as a gluon.sql.Rows object? 
> > 
> > > I have tried: 
> > 
> > >     raw_rows = legacy_db.executesql(sqlstr, as_dict=True) 
> > >     from gluon import sql 
> > >     columns = ['col1', 'col2', 'col3'] 
> > >     rowsobj = sql.Rows(legacy_db, raw_rows, columns) 
> > >     table = SQLTABLE(rowsobj) 
> > 
> > > but this blows up in sql.Rows. I'm just looking for a quick and dirty 
> > > (throw-away) way to do some reports with existing complex SQL queries. 
> > 
> > > Thanks, 
> > > Dave

Reply via email to