See http://stackoverflow.com/a/35159596/440323. You're using "and" instead
of "&".
Anthony
On Thursday, February 4, 2016 at 12:38:59 PM UTC-5, Valdeck Rowe wrote:
>
> Hi,
> Just getting into web2py, but I've been having this issue.
>
> Why does the following query:
>
> query = db.bids.job_id == job_id and db.bids.confirmed=='No' and
> db.bids.delivered=='No'
>
> on this table structure:
>
> db.define_table('bids',
> Field('body', 'text', label="Application"),
> Field('selected', 'string', requires=IS_IN_SET(['Yes',
> 'No']), readable=False, writable=False, default='No',
> widget=SQLFORM.widgets.radio.widget, label="Select this application"),
> Field('confirmed', 'string', requires=IS_IN_SET(['Yes',
> 'No']), readable=False, writable=False, default='No',
> widget=SQLFORM.widgets.radio.widget, label="Confirm acceptance"),
> Field('delivered', 'string', requires=IS_IN_SET(['Yes',
> 'No']), readable=False, writable=False, default='No'),
> Field('posted_on', 'datetime', readable=True,
> writable=False),
> Field('posted_by', 'reference auth_user', readable=False,
> writable=False),
> Field('job_id', 'reference jobs', readable=False,
> writable=False)
> )
>
>
> give this error:
>
> <type 'exceptions.KeyError'>
>
> For reference the job table definition is:
> db.define_table('jobs',
> Field('job', 'string', requires=[IS_LENGTH(50,1),
> IS_NOT_EMPTY()]),
> Field('posted_on', 'datetime', readable=True,
> writable=False),
> Field('posted_by', 'reference auth_user', readable=False,
> writable=False, default='auth_user.id'),
> format='%(Job)s')
>
> I'm expecting the equivalent of this be performed on the table:
> SELECT
> <http://localhost/phpmyadmin/url.php?url=http://dev.mysql.com/doc/refman/5.5/en/select.html>
> * FROM `bids` where job_id = 2 and
> <http://localhost/phpmyadmin/url.php?url=http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html#operator_and>
> confirmed = 'No' and
> <http://localhost/phpmyadmin/url.php?url=http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html#operator_and>
> delivered = 'No'
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.