is it possible to create a GQL format query and send it to the GAE
datastore that web2py connects to? what would the code for that be?

On Jun 15, 10:25 am, Dan <[email protected]> wrote:
> the IN operator is supported according 
> tohttp://code.google.com/appengine/docs/python/datastore/queriesandinde...
>
> The IN operator also performs multiple queries, one for each item in
> the provided list value where all other filters are the same and the
> IN filter is replaces with an equal-to filter. The results are merged,
> in the order of the items in the list. If a query has more than IN
> filter, the query is performed as multiple queries, one for each
> combination of values in the IN filters.
> A single query containing != and IN operators is limited to 30 sub-
> queries.
>
> but it looks like the gql.py file has commented out the code for
> belongs/IN (line 309) -- why?
>
> On Jun 15, 10:16 am, mdipierro <[email protected]> wrote:
>
> > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to