I experienced the same problem regarding this problem, then I tried to
iterate over the results and increment the count one by one but this
obviously trigger :

"This request used a high amount of CPU, and was roughly 5.1 times
over the average request CPU limit. High CPU requests have a small
quota, and if you exceed this quota, your app will be temporarily
disabled."

is there any workaround that doesn't trigger CPU warning?



On Jul 25, 7:55 am, "Marzia Niccolai" <[EMAIL PROTECTED]> wrote:
> Thanks for the report, I've brought the issue to the attention of our
> engineering team.
>
> -Marzia
>
> On Thu, Jul 24, 2008 at 6:57 AM, Abel Rodriguez <[EMAIL PROTECTED]>
> wrote:
>
> > @afrobeard
>
> > I put my comment to your report, thanks,
>
> > 2008/7/24 afrobeard <[EMAIL PROTECTED]>:
>
> >> @Abel
>
> >> I filed the bug up on:-
>
> >>http://code.google.com/p/googleappengine/issues/detail?id=586&sort=-i...
>
> >> You can raise the number of stars or comment on it there. More stars
> >> means that google should hopefully solve it first.
>
> >> On Jul 24, 4:46 am, Nevin Freeman <[EMAIL PROTECTED]> wrote:
> >> > I don't think this is actually a bug. In the first example you give,
> >> > you never actually preform the query. See:
> >>http://code.google.com/appengine/docs/datastore/creatinggettinganddel...
> >> > (the part under "Executing the Query and Accessing Results")
>
> >> > You can execute the query by calling query_name.fetch(), or by
> >> > iterating over it (AppEngine automatically executes the query). Your
> >> > second example invokes that behavior with the "for a in r:" part. If
> >> > you were to do:
>
> >> > r = db.GqlQuery("SELECT * FROM Mojo WHERE keywords IN :1",
> >> > ['pakistan',
> >> > 'punjab'])
> >> > r.fetch(50)
> >> > print r.count()
>
> >> > I think it might work.
>
> >> > Nevin
>
> >> > On Jul 22, 7:38 am, afrobeard <[EMAIL PROTECTED]> wrote:
>
> >> > > I'm making a model with a string list in it:-
>
> >> > > class Mojo(db.Model):
> >> > >     keywords = db.StringListProperty()
>
> >> > > Then I added an Instance:-
>
> >> > > m = Mojo(keywords = ['punjab','pakistan'])
> >> > > m.put()
>
> >> > > After which I executed the following lines of code:-
>
> >> > > r = db.GqlQuery("SELECT * FROM Mojo WHERE keywords IN :1",['pakistan',
> >> > > 'punjab'])
> >> > > print r.count()
>
> >> > > to which I got the following error message:-
>
> >> > > Traceback (most recent call last):
> >> > >   File "C:\Program Files\Google\google_appengine\google\appengine\ext
> >> > > \admin\__init__.py", line 180, in post
> >> > >     exec(compiled_code, globals())
> >> > >   File "<string>", line 6, in <module>
> >> > >   File "C:\Program Files\Google\google_appengine\google\appengine\ext
> >> > > \db\__init__.py", line 1276, in count
> >> > >     return self._get_query().Count(limit=limit)
> >> > >   File "C:\Program Files\Google\google_appengine\google\appengine\api
> >> > > \datastore.py", line 951, in Count
> >> > >     self._ToPb(limit=limit), resp)
> >> > >   File "C:\Program Files\Google\google_appengine\google\appengine\api
> >> > > \datastore.py", line 1104, in _ToPb
> >> > >     pb.set_kind(self.__kind.encode('utf-8'))
> >> > > AttributeError: 'NoneType' object has no attribute 'encode'
>
> >> > > However if I execute this :-
>
> >> > > r = db.GqlQuery("SELECT * FROM Mojo WHERE keywords IN :1",['pakistan',
> >> > > 'punjab'])
>
> >> > > for a in r:
> >> > >     print a.keywords
>
> >> > > I get :-
>
> >> > > [u'punjab',u'pakistan']
> >> > > [u'punjab',u'pakistan']
> >> > > [u'punjab',u'pakistan']
>
> >> > > Note:-
> >> > > This is the simplest repro done using the interactive console.
> >> > > The same behavior is also exhibited when everything is put on google's
> >> > > server and not executed from dev_appserver.py
>
> >> > > This shouldn't come up, any idea how we can get Google to correct his
> >> > > behavior ?
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to