class documentation

class Result(object):

View In Hierarchy

Invokes a .BakedQuery against a .Session.

The _baked.Result object is where the actual .query.Query object gets created, or retrieved from the cache, against a target .Session, and is then invoked for results.

Method all Return all rows.
Method count return the 'count'.
Method first Return the first row.
Method get Retrieve an object based on identity.
Method one Return exactly one result or raise an exception.
Method one​_or​_none Return one or zero results, or raise an exception for multiple rows.
Method params Specify parameters to be replaced into the string SQL statement.
Method scalar Return the first element of the first result or None if no rows present. If multiple rows are returned, raises MultipleResultsFound.
Method with​_post​_criteria Add a criteria function that will be applied post-cache.
Method __init__ Undocumented
Method __iter__ Undocumented
Method __str__ Undocumented
Method ​_as​_query Undocumented
Method ​_iter Undocumented
Method ​_load​_on​_pk​_identity Load the given primary key identity from the database.
Method ​_using​_post​_criteria Undocumented
Class Variable __slots__ Undocumented
Instance Variable ​_params Undocumented
Instance Variable ​_post​_criteria Undocumented
Instance Variable bq Undocumented
Instance Variable session Undocumented
def all(self):

Return all rows.

Equivalent to _query.Query.all.

def count(self):

return the 'count'.

Equivalent to _query.Query.count.

Note this uses a subquery to ensure an accurate count regardless of the structure of the original statement.

New in version 1.1.6.
def first(self):

Return the first row.

Equivalent to _query.Query.first.

def get(self, ident):

Retrieve an object based on identity.

Equivalent to _query.Query.get.

def one(self):

Return exactly one result or raise an exception.

Equivalent to _query.Query.one.

def one_or_none(self):

Return one or zero results, or raise an exception for multiple rows.

Equivalent to _query.Query.one_or_none.

New in version 1.0.9.
def params(self, *args, **kw):
Specify parameters to be replaced into the string SQL statement.
def scalar(self):

Return the first element of the first result or None if no rows present. If multiple rows are returned, raises MultipleResultsFound.

Equivalent to _query.Query.scalar.

New in version 1.1.6.
def with_post_criteria(self, fn):

Add a criteria function that will be applied post-cache.

This adds a function that will be run against the _query.Query object after it is retrieved from the cache. This currently includes only the _query.Query.params and _query.Query.execution_options methods.

Warning

_baked.Result.with_post_criteria functions are applied to the _query.Query object after the query's SQL statement object has been retrieved from the cache. Only _query.Query.params and _query.Query.execution_options methods should be used.

New in version 1.2.
def __init__(self, bq, session):

Undocumented

def __iter__(self):

Undocumented

def __str__(self):

Undocumented

def _as_query(self):

Undocumented

def _iter(self):

Undocumented

def _load_on_pk_identity(self, session, query, primary_key_identity, **kw):
Load the given primary key identity from the database.
def _using_post_criteria(self, fns):

Undocumented

__slots__: tuple[str, ...] =

Undocumented

_params: dict =

Undocumented

_post_criteria: list =

Undocumented

bq =

Undocumented

session =

Undocumented