[web2py] db.executesql(..., as_dict=True) seem buggy
Hello, Consider this : db.executesql("SELECT field1 AS Field1 FROM table1", as_dict = True) Where field1 have been capitalize ("AS Field1")... But the dicts keys are all small cap... At least under web2py 2.3.2 Richard -- --- 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/groups/opt_out.
Re: [web2py] db.executesql(..., as_dict=True) seem buggy
What database are you using? Did it work prior to web2py 2.3.2? The dict keys (field names) are retrieved from the cursor.description provided by the database driver so I suppose it is possible that your driver is changing the case - web2py shouldn't be affecting the case though. I use executesql (MSSQL & SQLite) a lot and haven't had any issues with a lack of capitalization. ~Brian On Friday, February 8, 2013 2:05:51 PM UTC-6, Richard wrote: > > Hello, > > Consider this : > db.executesql("SELECT field1 AS Field1 FROM table1", as_dict = True) > > Where field1 have been capitalize ("AS Field1")... > > But the dicts keys are all small cap... > > At least under web2py 2.3.2 > > Richard > -- --- 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/groups/opt_out.
Re: [web2py] db.executesql(..., as_dict=True) seem buggy
I use postgres with psycopg2, never try with other version, it a new I had developped where I was needing to do that. Richard On Fri, Feb 8, 2013 at 5:30 PM, Brian M wrote: > What database are you using? Did it work prior to web2py 2.3.2? The dict > keys (field names) are retrieved from the cursor.description provided by > the database driver so I suppose it is possible that your driver is > changing the case - web2py shouldn't be affecting the case though. I use > executesql (MSSQL & SQLite) a lot and haven't had any issues with a lack of > capitalization. > > ~Brian > > > On Friday, February 8, 2013 2:05:51 PM UTC-6, Richard wrote: >> >> Hello, >> >> Consider this : >> db.executesql("SELECT field1 AS Field1 FROM table1", as_dict = True) >> >> Where field1 have been capitalize ("AS Field1")... >> >> But the dicts keys are all small cap... >> >> At least under web2py 2.3.2 >> >> Richard >> > -- > > --- > 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/groups/opt_out. > > > -- --- 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/groups/opt_out.
Re: [web2py] db.executesql(..., as_dict=True) seem buggy
Ok, was coming from postgres, I have to double quote it in order to get postgres respect upper cases. With : SELECT field AS Field FROM ... Postgres return field With SELECT field AS "Field" FROM ... Postgres return Field May be it is my SQL that was bad at the start, standard SQL may required double quotes for AS... Thanks Richard On Sat, Feb 9, 2013 at 11:55 AM, Richard Vézina wrote: > I use postgres with psycopg2, never try with other version, it a new I had > developped where I was needing to do that. > > Richard > > > > On Fri, Feb 8, 2013 at 5:30 PM, Brian M wrote: > >> What database are you using? Did it work prior to web2py 2.3.2? The >> dict keys (field names) are retrieved from the cursor.description provided >> by the database driver so I suppose it is possible that your driver is >> changing the case - web2py shouldn't be affecting the case though. I use >> executesql (MSSQL & SQLite) a lot and haven't had any issues with a lack of >> capitalization. >> >> ~Brian >> >> >> On Friday, February 8, 2013 2:05:51 PM UTC-6, Richard wrote: >>> >>> Hello, >>> >>> Consider this : >>> db.executesql("SELECT field1 AS Field1 FROM table1", as_dict = True) >>> >>> Where field1 have been capitalize ("AS Field1")... >>> >>> But the dicts keys are all small cap... >>> >>> At least under web2py 2.3.2 >>> >>> Richard >>> >> -- >> >> --- >> 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/groups/opt_out. >> >> >> > > -- --- 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/groups/opt_out.