Query.fetch(limit=2000) only moves cursor forward by 1000 entities?
Posted
by Liron
on Stack Overflow
See other posts from Stack Overflow
or by Liron
Published on 2010-05-19T02:26:56Z
Indexed on
2010/05/19
2:30 UTC
Read the original article
Hit count: 245
google-app-engine
Let's say I have 2500 MyModel entities in my datastore, and I run this code:
query = MyModel.all()
first_batch = query.fetch(2000)
len(first_batch) # 2000
next_query = MyModel.all().with_cursor(query.cursor())
next_batch = next_query.fetch(2000)
What do you think len(next_batch)
is? 500, right? Nope - it's 1500. Apparently the query cursor never moves forward by more than 1000, even when the query itself returns more than 1000 entities.
Should I do something different or is it just an App Engine bug?
© Stack Overflow or respective owner