Query
scixplorer.query.Query
Query(model, fields=())class
An immutable query over a model; build it with Model.select.
Builder methods (where, order_by, limit, offset, using) return a new query. Iterating streams results as the backend produces them; once an iteration completes, the results are cached on this query, and later iterations, all, count, len() and indexing make no further requests.
scixplorer.query.Query.model
property model
The model being queried.
scixplorer.query.Query.fields
property fields
The fields to fetch; empty means all stored fields.
scixplorer.query.Query.expr
property expr
The filter expression, or None to match everything.
scixplorer.query.Query.order
property order
The sort keys, most significant first.
scixplorer.query.Query.limit_
property limit_
The maximum number of rows, or None for no limit.
scixplorer.query.Query.offset_
property offset_
The number of leading rows to skip.
scixplorer.query.Query.client
property client
The client requests are sent with; None means the default client.
scixplorer.query.Query.where
where(*exprs)Return a query also requiring every one of exprs (AND-ed with any existing filter).
scixplorer.query.Query.order_by
order_by(*keys)Return a query sorted by keys (replacing any previous ordering).
Each key is an scixplorer.expr.Order (from .asc()/.desc()) or a field handle or name, meaning ascending. No keys removes the ordering.
scixplorer.query.Query.limit
limit(n)Return a query yielding at most n rows (None for no limit).
scixplorer.query.Query.offset
offset(n)Return a query skipping the first n rows.
scixplorer.query.Query.using
using(client)Return a query sending requests with client (None for the default client).
scixplorer.query.Query.all
all()All rows, as a new list.
scixplorer.query.Query.aall
async def aall()Asynchronous all.
scixplorer.query.Query.first
first()The first row, or None. Fetches at most one row unless already cached.
scixplorer.query.Query.afirst
async def afirst()Asynchronous first.
scixplorer.query.Query.get
get()The first row; raises model.DoesNotExist if there is none.
scixplorer.query.Query.aget
async def aget()Asynchronous get.
scixplorer.query.Query.exists
exists()Whether there is at least one row. Fetches at most one row unless cached.
scixplorer.query.Query.aexists
async def aexists()Asynchronous exists.
scixplorer.query.Query.count
count()The number of rows iteration would yield, asking the backend unless cached.
scixplorer.query.Query.acount
async def acount()Asynchronous count.
scixplorer.query.Query.explain
explain()Describe how this query would be executed, without executing it.
scixplorer.query.Explanation
Explanation(summary, requests=(), notes=())class
What executing a query would do.
requests are the first request(s) that would be sent (empty if the query is answered without any), and notes are further details worth showing.