Sure you didn't forget db.yourtable.id ? Happened to me while testing ..... NB: "select * from person" will return (id, name, email) rows. if you passed fieldnames=[db.person.name, db.person.email] with select * from person that's the error you're facing.
On Thursday, August 30, 2012 11:24:34 PM UTC+2, Mike Girard wrote: > > It's screaming invalid literals anyway. Think I'll skip it. > > On Thursday, August 30, 2012 5:07:19 PM UTC-4, Niphlod wrote: >> >> right doc location. executesql is a method of dal, so click here and >> there and you'll end up at >> http://www.web2py.com/examples/static/epydoc/web2py.gluon.dal.DAL-class.html#executesql >> >> On Thursday, August 30, 2012 11:00:30 PM UTC+2, Mike Girard wrote: >>> >>> Sorry, didn't mean to have people running errands for me. Where is the >>> docstring? Was poking around here >>> http://www.web2py.com/examples/static/epydoc/index.html and couldn't >>> find what I was looking for. >>> >>> Too much newbieness i know: Python AND Web2py. >>> >>> On Thursday, August 30, 2012 4:56:09 PM UTC-4, Anthony wrote: >>>> >>>> On Thursday, August 30, 2012 4:31:37 PM UTC-4, Mike Girard wrote: >>>>> >>>>> So today's announcement of the new release included a suggestion that >>>>> an executesql result can be returned as Rows. If this is true, can I see >>>>> a >>>>> usage example? A little puzzled by 'fields=,columns='? >>>> >>>> >>>> db.define_table('person', Field('name'), Field('email')) >>>> db.define_table('dog', Field('name'), Field('owner', 'reference person' >>>> )) >>>> db.executesql([SQL code returning person.name and dog.name fields],fields >>>> =[db.person.name, db.dog.name]) >>>> db.executesql([SQL code returning all fields from db.person], fields=db >>>> .person) >>>> db.executesql([SQL code returning all fields from both tables], fields >>>> =[db.person, db.dog]) >>>> db.executesql([SQL code returning person.name and all db.dog fields],fields >>>> =[db.person.name, db.dog]) >>>> >>>> Here's the docstring: >>>> >>>> Added 2012-08-24 "fields" optional argument. If not None, the >>>> results cursor returned by the DB driver will be converted to a >>>> DAL Rows object using the db._adapter.parse() method. Thisrequires >>>> specifying the "fields" argument as a list of DAL Field objects >>>> that match the fields returned from the DB. The Field objects >>>> should >>>> be part of one or more Table objects defined on the DAL object. >>>> The "fields" list can include one or more DAL Table objects >>>> inaddition >>>> to or instead of including Field objects, or it can be just a >>>> single >>>> table (not in a list). In that case, the Field objects will be >>>> extracted from the table(s). >>>> >>>> The field names will be extracted from the Field objects, >>>> oroptionally >>>> , >>>> a list of field names can be provided (in tablename.fieldname >>>> format) >>>> via the "colnames" argument. Note, the fields and colnames >>>> must be in >>>> the same order as the fields in the results cursor returned >>>> from the DB. >>>> >>>> Anthony >>>> >>>> --

