The problem is that you call .as_list(), which converts to a list of dictionaries, and dictionaries do not preserve the order of keys. Do you need a list of dictionaries?
On Thursday, January 1, 2015 3:09:22 PM UTC-5, aapaap wrote: > > hello, > > I'm using dygraph to plot a number of parameters. > Dygraph needs a csv file as it's input. > So I made a service: > > @service.csv > def service_platdak(): > ToDay = date.today() > Tomorrow = ( ToDay + timedelta (1) ) > > Fields = [ db.Compare_Model.Date, > db.Compare_Model.M2,db.Compare_Model.M2_s1 ] > Rows = db ( ( db.Compare_Model.Date >= ToDay ) & > ( db.Compare_Model.Date < Tomorrow ) & > ( db.Compare_Model.M2 > 0.01 ) ).select( > *Fields, > orderby = db.Compare_Model.Date ).as_list() > return Rows > > This works almost, except the order of the fileds is not maintained (M2 > and M2_s1 are exchanged): > > Date,M2_s1,M2 > 2015-01-01 09:20:00,,0.666666666667 > 2015-01-01 09:30:00,,3.92857142857 > 2015-01-01 09:40:00,,8.5 > .... > > is there a way (other than raw SQL) to maintain the column order ? > > thanks, > Stef > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.