Мне показалось, что я понял концепцию курсоров и запросов, основанную на http://code.google.com/appengine/docs/python/datastore/queryclass.html, но, видимо, это не так, как я делаю в коде.
У меня в хранилище данных 310 товаров, и я хочу перебрать их в небольших пакетах размером 100:
query = Event.all()
query.order("__key__")
batch_size = 100;
# expecting this to return the 1st 100 of the 310 items
results = query.fetch(limit=batch_size)
logging.info("count 1: %d, results: %d" % (query.count(), len(results)))
# reports: count 1: 310, results: 100
for item in results:
print item # this will print items 1-100, which is expected
# Move to the next batch block
cursor = query.cursor();
query.with_cursor(cursor);
results = query.fetch(limit=batch_size)
logging.info("count 2: %d, results: %d" % (query.count(), len(results)))
# reports: count 2: 0, results: 0
# but was expecting to move to item 101
Как я могу перебрать все мои сущности партиями по 100? 'query.cursor()'
возвращает курсор, который находится в конце 1-го размера batch_size или в начале этого блока?