App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | Static Public Attributes | List of all members
google.appengine.datastore.datastore_query.Batcher Class Reference
Inheritance diagram for google.appengine.datastore.datastore_query.Batcher:

Public Member Functions

def __init__
 
def next
 
def next_batch
 
def __getstate__
 
def __iter__
 

Static Public Attributes

 ASYNC_ONLY = None
 
int AT_LEAST_OFFSET = 0
 
tuple AT_LEAST_ONE = object()
 

Detailed Description

A class that implements the Iterator interface for Batches.

Typically constructed by a call to Query.run().

The class hides the "best effort" nature of the datastore by potentially
making multiple requests to the datastore and merging the resulting batches.
This is accomplished efficiently by prefetching results and mixing both
non-blocking and blocking calls to the datastore as needed.

Iterating through batches is almost always more efficient than pulling all
results at once as RPC latency is hidden by asynchronously prefetching
results.

The batches produce by this class cannot be used to fetch the next batch
(through Batch.next_batch()) as before the current batch is returned the
request for the next batch has already been sent.

Constructor & Destructor Documentation

def google.appengine.datastore.datastore_query.Batcher.__init__ (   self,
  query_options,
  first_async_batch 
)
Constructor.

Although this class can be manually constructed, it is preferable to use
Query.run(query_options).

Args:
  query_options: The QueryOptions used to create the first batch.
  first_async_batch: The first batch produced by
Query.run_async(query_options).

Member Function Documentation

def google.appengine.datastore.datastore_query.Batcher.next (   self)
Get the next batch. See .next_batch().
def google.appengine.datastore.datastore_query.Batcher.next_batch (   self,
  min_batch_size 
)
Get the next batch.

The batch returned by this function cannot be used to fetch the next batch
(through Batch.next_batch()). Instead this function will always return None.
To retrieve the next batch use .next() or .next_batch(N).

This function may return a batch larger than min_to_fetch, but will never
return smaller unless there are no more results.

Special values can be used for min_batch_size:
  ASYNC_ONLY - Do not perform any synchrounous fetches from the datastore
even if the this produces a batch with no results.
  AT_LEAST_OFFSET - Only pull enough results to satifiy the offset.
  AT_LEAST_ONE - Pull batches until at least one result is returned.

Args:
  min_batch_size: The minimum number of results to retrieve or one of
(ASYNC_ONLY, AT_LEAST_OFFSET, AT_LEAST_ONE)

Returns:
  The next Batch of results.

The documentation for this class was generated from the following file: