I am trying to cycle through all elements of a table via the remote
API, using a modification of the code snippet from
http://code.google.com/appengine/articles/remote_api.html:

#---------------------------------------------------- SNIP
----------------------------------------------------
query = db.GqlQuery("SELECT __key__ FROM Model_mobileapp ORDER BY
__key__")
apps = query.fetch(500)
total = 0
while apps:
   total = total + len(apps)
   query2 = db.GqlQuery("SELECT __key__ FROM Model_mobileapp WHERE
__key__ > :1 ORDER BY __key__", apps[-1])
   apps = query2.fetch(500)

print "%d" % total
#---------------------------------------------------- SNAP
----------------------------------------------------

However, I'm getting unpredictable behaviour. Sometimes I get the
correct number (104512), sometimes I get 15999, 30999 and all sorts of
other values.

Does anyone have any clue what this could be caused by? Is there some
sort of magic caching going on for the fetch() command, that return
some keys which are not in the correct sorting order? Could the
(automatic) ascending key index be broken? Any ideas?

Thanks,
Ben

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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/google-appengine?hl=en.


Reply via email to