The offset is applied _after_ the query is executed and the entities
are fetched. Re-read the "Executing the Query and Accessing Results"
section from 
http://code.google.com/appengine/docs/datastore/creatinggettinganddeletingdata.html

So, using offset to go through all your entities is not a good idea.
You should use a __key__ query instead. Read the "Queries on Keys"
section from 
http://code.google.com/appengine/docs/datastore/queriesandindexes.html
for details, it even has a complete code sample.

Hope this helps.

Cheers,
Alex
--
www.muspy.com

On Jan 12, 4:12 am, wsstefan <wsste...@gmail.com> wrote:
> I wrote a cronjob that goes through and recalculates my members' ranks
> 10 at a time using the the following request:
>
> profiles = Profile.all().order('-score').fetch(10, offset)
>
> for profile in profiles:
>   # calculate rank
>
> but once I get to an offset of more than 4000 I get this:
>
> BadRequestError: offset may not be above 4000
>
> Google Team:  Why is this limit applied?  Otherwise I have to
> construct a seemingly less efficient query like this:
>
> mod_rank = int(offset % interval)
> profiles = Profile.all().filter('score <', rank_score).order('-
> score').fetch(10, mod_rank)
> if offset % interval == 0:
>   memcache.set('rank_score', profile.score)
--~--~---------~--~----~------------~-------~--~----~
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 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to