SQLAlchemy 0.3 Documentation - module sqlalchemy.ext.selectresults

# SQLAlchemy 0.3 Documentation

Multiple Pages | One Page
Version: 0.3.10 Last Updated: 07/20/07 17:20:04

### module sqlalchemy.ext.selectresults

### class SelectResults(object)

Build a query one component at a time via separate method calls, each call transforming the previous `SelectResults` instance into a new `SelectResults` instance with further limiting criterion added. When interpreted in an iterator context (such as via calling `list(selectresults)`), executes the query.

def __init__(self, query, clause=None, ops={}, joinpoint=None)

Construct a new `SelectResults` using the given `Query` object and optional `WHERE` clause. ops is an optional dictionary of bind parameter values.

def avg(self, col)

Execute the SQL `avg()` function against the given column.

def clone(self)

Create a copy of this `SelectResults`.

def compile(self)
def count(self)

Execute the SQL `count()` function against the `SelectResults` criterion.

def distinct(self)

Apply a `DISTINCT` to the query.

def filter(self, clause)

Apply an additional `WHERE` clause against the query.

def join_to(self, prop)

Join the table of this `SelectResults` to the table located against the given property name.

Subsequent calls to join_to or outerjoin_to will join against the rightmost table located from the previous join_to or outerjoin_to call, searching for the property starting with the rightmost mapper last located.

def limit(self, limit)

Apply a `LIMIT` to the query.

def list(self)

Return the results represented by this `SelectResults` as a list.

This results in an execution of the underlying query.

def max(self, col)

Execute the SQL `max()` function against the given column.

def min(self, col)

Execute the SQL `min()` function against the given column.

def offset(self, offset)

Apply an `OFFSET` to the query.

def options(self, *args, **kwargs)

Apply mapper options to the underlying query.

See also `Query.options`.

def order_by(self, order_by)

Apply an `ORDER BY` to the query.

def outerjoin_to(self, prop)

Outer join the table of this `SelectResults` to the table located against the given property name.

Subsequent calls to join_to or outerjoin_to will join against the rightmost table located from the previous `join_to` or `outerjoin_to` call, searching for the property starting with the rightmost mapper last located.

def select(self, clause)
def select_by(self, *args, **kwargs)
def select_from(self, from_obj)

Set the from_obj parameter of the query.

from_obj is a list of one or more tables.

def sum(self, col)

Execute the SQL `sum()` function against the given column.

back to section top

### class SelectResultsExt(MapperExtension)

a MapperExtension that provides SelectResults functionality for the results of query.select_by() and query.select()

def select(self, query, arg=None, **kwargs)
def select_by(self, query, *args, **params)
back to section top