Re: [web2py] Re: pysqlite2.dbapi2.OperationalError'> near "<": syntax error

2016-09-19 Thread Peter
The double db reference was definitely part of the problem but wasn't the whole story. I made a mistake in one of the field names... specifically AND (task.*task_status* = 'BILLABLE') should have been AND (task.*payment_status*="BILLABLE")); I actually had it correct in the SQL

Re: [web2py] Re: pysqlite2.dbapi2.OperationalError'> near "<": syntax error

2016-09-19 Thread Anthony
OK, got it. You are passing a Set object where you should have a Query object. You have: query = db(...) and then you have: rows = db(query).select(...) which is equivalent to: rows = db(db(...)).select(...) which is not allowed. When the Set object is passed to db(), it is converted to a

Re: [web2py] Re: pysqlite2.dbapi2.OperationalError'> near "<": syntax error

2016-09-19 Thread Peter
Error after changing .select()to._select() Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Traceback (most recent call last): File "/home/peter/web2py/gluon/restricted.py", line 227, in restricted exec ccode in environment File

Re: [web2py] Re: pysqlite2.dbapi2.OperationalError'> near "<": syntax error

2016-09-19 Thread Anthony
Replace .select() with ._select() and print/output the result so we can see the exact SQL generated. On Monday, September 19, 2016 at 11:53:49 AM UTC-4, Peter wrote: > > Thanks for your response Anthony! > > I have obviously misunderstood a reference I read somewhere saying that > reference

Re: [web2py] Re: pysqlite2.dbapi2.OperationalError'> near "<": syntax error

2016-09-19 Thread Peter Errity
Thanks for your response Anthony! I have obviously misunderstood a reference I read somewhere saying that reference fields were given special attributes and gave an example something like db.fieldname.name I assumed the trailing .name came from the referenced table attributes. So I have modified

[web2py] Re: pysqlite2.dbapi2.OperationalError'> near "<": syntax error

2016-09-19 Thread Anthony
First, note that the following is not doing what you think it is: rows=db(query).select(db.task.person, db.task.person.name, ...) db.task.person is a Field object, and it's "name" attribute is just the string name of the field itself, so the above is equivalent to: