As far as I know GAE does not support this. The only option is to use the ListProperty but web2py does not have an interface for it.
Massimo On Jun 15, 11:45 am, Dan <[email protected]> wrote: > What is the proper way to run a query on Google App Engine that uses > an IN clause? > > I want to do something like this (in traditional SQL) > SELECT person.name, person.age > FROM person > WHERE person.name IN ('Ralph','Henry','Sue') > > After searching around here and the web2py docs, I tried two different > approaches, and neither of them worked. Please let me know what I can > do to fix it. Thanks! > Dan > > FIRST ATTEMPT: > personlist = ['Ralph','Henry','Sue'] > personresultsqry = db.person.name.belongs(personlist) > personresults = db(personresultsqry).select(db.person.name, > db.person.age) > > the error from the GAE dev app server is this: > AttributeError: 'SQLField' object has no attribute 'belongs' > > SECOND ATTEMPT: > personlist = ['Ralph','Henry','Sue'] > personresultsqry = db.GqlQuery("SELECT * FROM web2py_person WHERE > name IN :1", personlist) > personresults = db(personresultsqry).select(db.person.name, > db.person.age) > > the error from the GAE dev app server is this: > KeyError: 'GqlQuery' --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

