What do you mean by "hangs up"?

In any even, setting an offset won't allow you to fetch beyond 1000
items.  What your code is attempting to do is:

1. fetch the first 1000 results of the query
2. re-fetch results 2-1000 and add them to the items list
(it should break at this point, since there are only 999 items in
batch 2, leaving you with a list of 1999 items, all but 1 of which are
duplicated).

On Sep 26, 1:01 pm, Tomi Korhonen <tomi.korho...@gmail.com> wrote:
> Hi,
>
> I am trying to fetch all entities from datastore ordered by date. The
> following code does not work (hangs up). Any ideas what is wrong with
> it?
>
>     items = []
>     offset = 0
>     while True:
>         tempItems = Item.all().order("date").fetch(1000, offset)
>         items.extend(tempItems)
>         if len(tempItems) < 1000:
>             break
>         offset = offset + 1
>
> br, Tomi
--~--~---------~--~----~------------~-------~--~----~
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