How to fetch more than 1000?

后端 未结 16 1987
囚心锁ツ
囚心锁ツ 2020-11-28 04:13

How can I fetch more than 1000 record from data store and put all in one single list to pass to django?

16条回答
  •  Happy的楠姐
    2020-11-28 04:40

    This 1K limit issue is resolved.

    query = MyModel.all()
    for doc in query:
        print doc.title
    

    By treating the Query object as an iterable: The iterator retrieves results from the datastore in small batches, allowing for the app to stop iterating on results to avoid fetching more than is needed. Iteration stops when all of the results that match the query have been retrieved. As with fetch(), the iterator interface does not cache results, so creating a new iterator from the Query object will re-execute the query.

    The max batch size is 1K. And you still have the auto Datastore quotas as well.

    But with the plan 1.3.1 SDK, they've introduced cursors that can be serialized and saved so that a future invocation can begin the query where it last left off at.

提交回复
热议问题