Part of storm.store View In Hierarchy
Implements interfaces: IResultSet
Note that having an instance of this class does not indicate that a database query has necessarily been made. Database queries are put off until absolutely necessary.
Generally these should not be constructed directly, but instead
retrieved from calls to Store.find.
| Method | __init__ | Undocumented |
| Method | copy | Return a copy of this ResultSet object, with the same configuration. |
| Method | config | Configure this result object in-place. All parameters are optional. |
| Method | __iter__ | Iterate the results of the query. |
| Method | __getitem__ | Get an individual item by offset, or a range of items by slice. |
| Method | __contains__ | Check if an item is contained within the result set. |
| Method | is_empty | Return True if this result set doesn't contain any
results. |
| Method | any | Return a single item from the result set. |
| Method | first | Return the first item from an ordered result set. |
| Method | last | Return the last item from an ordered result set. |
| Method | one | Return one item from a result set containing at most one item. |
| Method | order_by | Specify the ordering of the results. |
| Method | remove | Remove all rows represented by this ResultSet from the database. |
| Method | group_by | Group this ResultSet by the given expressions. |
| Method | having | Filter result previously grouped by. |
| Method | count | Get the number of objects represented by this ResultSet. |
| Method | max | Get the highest value from an expression. |
| Method | min | Get the lowest value from an expression. |
| Method | avg | Get the average value from an expression. |
| Method | sum | Get the sum of all values in an expression. |
| Method | get_select_expr | Get a Select
expression to retrieve only the specified columns. |
| Method | values | Retrieve only the specified columns. |
| Method | set | Update objects in the result set with the given arguments. |
| Method | cached | Return matching objects from the cache for the current query. |
| Method | find | Perform a query on objects within this result set. |
| Method | union | Get the Union of this
result set and another. |
| Method | difference | Get the difference, using Except, of this result set
and another. |
| Method | intersection | Get the Intersection of this result set and another. |
| Method | _get_select | Undocumented |
| Method | _load_objects | Undocumented |
| Method | _any | Return a single item from the result without changing sort order. |
| Method | _aggregate | Undocumented |
| Method | _set_expr | Undocumented |
| Parameters | distinct | Boolean enabling/disabling usage of the DISTINCT keyword in the query made. |
| offset | Offset where results will start to be retrieved from the result set. | |
| limit | Limit the number of objects retrieved from the result set. | |
| Returns | self (not a copy). | |
| Returns | The matching object or, if a slice is used, a new ResultSet will be
returned appropriately modified with OFFSET and
LIMIT clauses.
| |
| Returns | An arbitrary object or None if one isn't available.
| |
| See Also | one(), first(), and last(). | |
| Returns | An arbitrary object or None if one isn't available.
| |
| Returns | The first object or None if one isn't available.
| |
| Raises | UnorderedError | Raised if the result set isn't ordered. |
| See Also | last(), one(), and any(). | |
| Returns | The last object or None if one isn't available.
| |
| Raises | FeatureError | Raised if the result set has a LIMIT set.
|
| UnorderedError | Raised if the result set isn't ordered. | |
| See Also | first(), one(), and any(). | |
| Returns | The object or None if one isn't available.
| |
| Raises | NotOneError | Raised if the result set contains more than one item. |
| See Also | first(), one(), and any(). | |
The query will be modified appropriately with an ORDER BY clause.
Ascending and descending order can be specified by wrapping the columns
in Asc and Desc.
| Parameters | args | One or more storm.expr.Column objects.
|
This is done efficiently with a DELETE statement, so objects are not actually loaded into Python.
| Parameters | expr | The expressions used in the GROUP BY statement. |
| Returns | self (not a copy). | |
| Parameters | expr | Instances of Expr.
|
| Returns | self (not a copy). | |
Select
expression to retrieve only the specified columns.| Parameters | columns | One or more storm.expr.Column objects
whose values will be fetched.
|
| Returns | A Select expression
configured to use the query parameters specified for this result set, and
also limited to only retrieving data for the specified columns.
| |
| Raises | FeatureError | Raised if no columns are specified or if this result is a set expression such as a union. |
This does not load full objects from the database into Python.
| Parameters | columns | One or more storm.expr.Column objects
whose values will be fetched.
|
| Returns | An iterator of tuples of the values for each column from each matching row in the database. | |
| Raises | FeatureError | Raised if no columns are specified or if this result is a set expression such as a union. |
This method will update all objects in the current result set to match expressions given as equalities or keyword arguments. These objects may still be in the database (an UPDATE is issued) or may be cached.
For instance, result.set(Class.attr1 == 1, attr2=2) will
set attr1 to 1 and attr2 to 2, on all matching
objects.
This is analogous to Store.find, although it
doesn't take a cls_spec argument, instead using the same
tables as the existing result set, and restricts the results to those in
this set.
| Parameters | args | Instances of Expr.
|
| kwargs | Mapping of simple column names to values or expressions to query for. | |
| Returns | A ResultSet of
matching instances.
| |
Union of this
result set and another.| Parameters | all | If True, include duplicates. |
Except, of this result set
and another.| Parameters | all | If True, include duplicates. |