![]() |
App Engine Python SDK
v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
|
Public Member Functions | |
def | __init__ |
def | __repr__ |
def | run_to_queue |
def | kind |
def | ancestor |
def | filters |
def | orders |
def | app |
def | namespace |
def | default_options |
def | group_by |
def | projection |
def | is_distinct |
def | filter |
def | order |
def | iter |
def | map |
def | map_async |
def | fetch |
def | fetch_async |
def | get |
def | get_async |
def | count |
def | count_async |
def | fetch_page |
def | fetch_page_async |
def | analyze |
def | bind |
Query object. Usually constructed by calling Model.query(). See module docstring for examples. Note that not all operations on Queries are supported by _MultiQuery instances; the latter are generated as necessary when any of the operators !=, IN or OR is used.
def google.appengine.ext.ndb.query.Query.__init__ | ( | self, | |
kind = None , |
|||
ancestor = None , |
|||
filters = None , |
|||
orders = None , |
|||
app = None , |
|||
namespace = None , |
|||
default_options = None , |
|||
projection = None , |
|||
group_by = None |
|||
) |
Constructor. Args: kind: Optional kind string. ancestor: Optional ancestor Key. filters: Optional Node representing a filter expression tree. orders: Optional datastore_query.Order object. app: Optional app id. namespace: Optional namespace. default_options: Optional QueryOptions object. projection: Optional list or tuple of properties to project. group_by: Optional list or tuple of properties to group by.
def google.appengine.ext.ndb.query.Query.analyze | ( | self | ) |
Return a list giving the parameters required by a query.
def google.appengine.ext.ndb.query.Query.ancestor | ( | self | ) |
Accessor for the ancestor (a Key or None).
def google.appengine.ext.ndb.query.Query.app | ( | self | ) |
Accessor for the app (a string or None).
def google.appengine.ext.ndb.query.Query.bind | ( | self, | |
args, | |||
kwds | |||
) |
Bind parameter values. Returns a new Query object.
def google.appengine.ext.ndb.query.Query.count | ( | self, | |
limit = None , |
|||
q_options | |||
) |
Count the number of query results, up to a limit. This returns the same result as len(q.fetch(limit)) but more efficiently. Note that you must pass a maximum value to limit the amount of work done by the query. Args: limit: How many results to count at most. **q_options: All query options keyword arguments are supported. Returns:
def google.appengine.ext.ndb.query.Query.count_async | ( | self, | |
limit = None , |
|||
q_options | |||
) |
Count the number of query results, up to a limit. This is the asynchronous version of Query.count().
def google.appengine.ext.ndb.query.Query.default_options | ( | self | ) |
Accessor for the default_options (a QueryOptions instance or None).
def google.appengine.ext.ndb.query.Query.fetch | ( | self, | |
limit = None , |
|||
q_options | |||
) |
Fetch a list of query results, up to a limit. Args: limit: How many results to retrieve at most. **q_options: All query options keyword arguments are supported. Returns: A list of results.
def google.appengine.ext.ndb.query.Query.fetch_async | ( | self, | |
limit = None , |
|||
q_options | |||
) |
Fetch a list of query results, up to a limit. This is the asynchronous version of Query.fetch().
def google.appengine.ext.ndb.query.Query.fetch_page | ( | self, | |
page_size, | |||
q_options | |||
) |
Fetch a page of results. This is a specialized method for use by paging user interfaces. Args: page_size: The requested page size. At most this many results will be returned. In addition, any keyword argument supported by the QueryOptions class is supported. In particular, to fetch the next page, you pass the cursor returned by one call to the next call using start_cursor=<cursor>. A common idiom is to pass the cursor to the client using <cursor>.to_websafe_string() and to reconstruct that cursor on a subsequent request using Cursor.from_websafe_string(<string>). Returns: A tuple (results, cursor, more) where results is a list of query results, cursor is a cursor pointing just after the last result returned, and more is a bool indicating whether there are (likely) more results after that.
def google.appengine.ext.ndb.query.Query.fetch_page_async | ( | self, | |
page_size, | |||
q_options | |||
) |
Fetch a page of results. This is the asynchronous version of Query.fetch_page().
def google.appengine.ext.ndb.query.Query.filter | ( | self, | |
args | |||
) |
Return a new Query with additional filter(s) applied.
def google.appengine.ext.ndb.query.Query.filters | ( | self | ) |
Accessor for the filters (a Node or None).
def google.appengine.ext.ndb.query.Query.get | ( | self, | |
q_options | |||
) |
Get the first query result, if any. This is similar to calling q.fetch(1) and returning the first item of the list of results, if any, otherwise None. Args: **q_options: All query options keyword arguments are supported. Returns: A single result, or None if there are no results.
def google.appengine.ext.ndb.query.Query.get_async | ( | self, | |
q_options | |||
) |
Get the first query result, if any. This is the asynchronous version of Query.get().
def google.appengine.ext.ndb.query.Query.group_by | ( | self | ) |
Accessor for the group by properties (a tuple instance or None).
def google.appengine.ext.ndb.query.Query.is_distinct | ( | self | ) |
True if results are guaranteed to contain a unique set of property values. This happens when every property in the group_by is also in the projection.
def google.appengine.ext.ndb.query.Query.iter | ( | self, | |
q_options | |||
) |
Construct an iterator over the query. Args: **q_options: All query options keyword arguments are supported. Returns: A QueryIterator object.
def google.appengine.ext.ndb.query.Query.kind | ( | self | ) |
Accessor for the kind (a string or None).
def google.appengine.ext.ndb.query.Query.map | ( | self, | |
callback, | |||
pass_batch_into_callback = None , |
|||
merge_future = None , |
|||
q_options | |||
) |
Map a callback function or tasklet over the query results. Args: callback: A function or tasklet to be applied to each result; see below. merge_future: Optional Future subclass; see below. **q_options: All query options keyword arguments are supported. Callback signature: The callback is normally called with an entity as argument. However if keys_only=True is given, it is called with a Key. Also, when pass_batch_into_callback is True, it is called with three arguments: the current batch, the index within the batch, and the entity or Key at that index. The callback can return whatever it wants. If the callback is None, a trivial callback is assumed that just returns the entity or key passed in (ignoring produce_cursors). Optional merge future: The merge_future is an advanced argument that can be used to override how the callback results are combined into the overall map() return value. By default a list of callback return values is produced. By substituting one of a small number of specialized alternatives you can arrange otherwise. See tasklets.MultiFuture for the default implementation and a description of the protocol the merge_future object must implement the default. Alternatives from the same module include QueueFuture, SerialQueueFuture and ReducingFuture. Returns: When the query has run to completion and all callbacks have returned, map() returns a list of the results of all callbacks. (But see 'optional merge future' above.)
def google.appengine.ext.ndb.query.Query.map_async | ( | self, | |
callback, | |||
pass_batch_into_callback = None , |
|||
merge_future = None , |
|||
q_options | |||
) |
Map a callback function or tasklet over the query results. This is the asynchronous version of Query.map().
def google.appengine.ext.ndb.query.Query.namespace | ( | self | ) |
Accessor for the namespace (a string or None).
def google.appengine.ext.ndb.query.Query.order | ( | self, | |
args | |||
) |
Return a new Query with additional sort order(s) applied.
def google.appengine.ext.ndb.query.Query.orders | ( | self | ) |
Accessor for the filters (a datastore_query.Order or None).
def google.appengine.ext.ndb.query.Query.projection | ( | self | ) |
Accessor for the projected properties (a tuple instance or None).
def google.appengine.ext.ndb.query.Query.run_to_queue | ( | self, | |
queue, | |||
conn, | |||
options = None , |
|||
dsquery = None |
|||
) |
Run this query, putting entities into the given queue.