class documentation

class CompositeBundle(orm_util.Bundle[_T]): (source)

View In Hierarchy

Undocumented

Method __init__ Construct a new :class:`.Bundle`.
Method create_row_processor Produce the "row processing" function for this :class:`.Bundle`.
Instance Variable property Undocumented

Inherited from Bundle:

Method __clause_element__ Undocumented
Method label Provide a copy of this :class:`.Bundle` passing a new label.
Class Variable is_aliased_class True if this object is an instance of :class:`.AliasedClass`.
Class Variable is_bundle True if this object is an instance of :class:`.Bundle`.
Class Variable is_clause_element True if this object is an instance of :class:`_expression.ClauseElement`.
Class Variable is_mapper True if this object is an instance of :class:`_orm.Mapper`.
Instance Variable c An alias for :attr:`.Bundle.columns`.
Instance Variable columns A namespace of SQL expressions referred to by this :class:`.Bundle`.
Instance Variable exprs Undocumented
Instance Variable name Undocumented
Instance Variable single_entity If True, queries for a single Bundle will be returned as a single entity, rather than an element within a keyed tuple.
Property clauses Undocumented
Property entity Undocumented
Property entity_namespace Undocumented
Property mapper Undocumented
Method _clone clone this element
Method _gen_cache_key return an optional cache key.
Class Variable _propagate_attrs Undocumented
Instance Variable _label Undocumented

Inherited from ORMColumnsClauseRole (via Bundle):

Class Variable __slots__ Undocumented
Class Variable _role_name Undocumented

Inherited from ColumnsClauseRole (via Bundle, ORMColumnsClauseRole):

Property _select_iterable Undocumented

Inherited from AllowsLambdaRole (via Bundle, ORMColumnsClauseRole, ColumnsClauseRole):

Class Variable allows_lambda Undocumented

Inherited from UsesInspection (via Bundle, ORMColumnsClauseRole, ColumnsClauseRole, AllowsLambdaRole):

Class Variable uses_inspection Undocumented
Class Variable _post_inspect Undocumented

Inherited from SupportsCloneAnnotations (via Bundle, ORMColumnsClauseRole, ColumnsClauseRole, AllowsLambdaRole, UsesInspection, ColumnListRole, TypedColumnsClauseRole):

Method _annotate return a copy of this ClauseElement with annotations updated by the given dictionary.
Method _deannotate return a copy of this :class:`_expression.ClauseElement` with annotations removed.
Method _with_annotations return a copy of this ClauseElement with annotations replaced by the given dictionary.
Class Variable _clone_annotations_traverse_internals Undocumented

Inherited from SupportsWrappingAnnotations (via Bundle, ORMColumnsClauseRole, ColumnsClauseRole, AllowsLambdaRole, UsesInspection, ColumnListRole, TypedColumnsClauseRole, SupportsCloneAnnotations):

Class Variable _constructor Undocumented

Inherited from SupportsAnnotations (via Bundle, ORMColumnsClauseRole, ColumnsClauseRole, AllowsLambdaRole, UsesInspection, ColumnListRole, TypedColumnsClauseRole, SupportsCloneAnnotations, SupportsWrappingAnnotations):

Class Variable proxy_set Undocumented
Method _gen_annotations_cache_key Undocumented
Class Variable _is_immutable Undocumented
Property _annotations_cache_key Undocumented

Inherited from ExternallyTraversible (via Bundle, ORMColumnsClauseRole, ColumnsClauseRole, AllowsLambdaRole, UsesInspection, ColumnListRole, TypedColumnsClauseRole, SupportsCloneAnnotations, SupportsWrappingAnnotations, SupportsAnnotations):

Method get_children Return immediate child :class:`.visitors.HasTraverseInternals` elements of this :class:`.visitors.HasTraverseInternals`.
Method _copy_internals Reassign internal elements to be clones of themselves.

Inherited from HasTraverseInternals (via Bundle, ORMColumnsClauseRole, ColumnsClauseRole, AllowsLambdaRole, UsesInspection, ColumnListRole, TypedColumnsClauseRole, SupportsCloneAnnotations, SupportsWrappingAnnotations, SupportsAnnotations, ExternallyTraversible):

Class Variable _traverse_internals Undocumented

Inherited from Visitable (via Bundle, ORMColumnsClauseRole, ColumnsClauseRole, AllowsLambdaRole, UsesInspection, ColumnListRole, TypedColumnsClauseRole, SupportsCloneAnnotations, SupportsWrappingAnnotations, SupportsAnnotations, ExternallyTraversible, HasTraverseInternals):

Method __class_getitem__ Undocumented
Method __init_subclass__ Undocumented
Class Variable __visit_name__ Undocumented
Class Method _generate_compiler_dispatch Undocumented
Method _compiler_dispatch Undocumented
Class Variable _original_compiler_dispatch Undocumented

Inherited from MemoizedHasCacheKey (via Bundle, ORMColumnsClauseRole, ColumnsClauseRole, AllowsLambdaRole, UsesInspection, ColumnListRole, TypedColumnsClauseRole, SupportsCloneAnnotations, SupportsWrappingAnnotations, SupportsAnnotations, ExternallyTraversible, HasTraverseInternals, Visitable):

Method _generate_cache_key return a cache key.

Inherited from HasCacheKey (via Bundle, ORMColumnsClauseRole, ColumnsClauseRole, AllowsLambdaRole, UsesInspection, ColumnListRole, TypedColumnsClauseRole, SupportsCloneAnnotations, SupportsWrappingAnnotations, SupportsAnnotations, ExternallyTraversible, HasTraverseInternals, Visitable, MemoizedHasCacheKey):

Class Variable inherit_cache Indicate if this :class:`.HasCacheKey` instance should make use of the cache key generation scheme used by its immediate superclass.
Class Method _generate_cache_attrs generate cache key dispatcher for a new class.
Class Method _generate_cache_key_for_object Undocumented
Class Variable _generated_cache_key_traversal Undocumented
Class Variable _hierarchy_supports_caching private attribute which may be set to False to prevent the inherit_cache warning from being emitted for a hierarchy of subclasses.
Class Variable _is_has_cache_key Undocumented

Inherited from InspectionAttr (via Bundle, ORMColumnsClauseRole, ColumnsClauseRole, AllowsLambdaRole, UsesInspection, ColumnListRole, TypedColumnsClauseRole, SupportsCloneAnnotations, SupportsWrappingAnnotations, SupportsAnnotations, ExternallyTraversible, HasTraverseInternals, Visitable, MemoizedHasCacheKey, HasCacheKey, Inspectable, SQLRole):

Class Variable is_attribute True if this object is a Python :term:`descriptor`.
Class Variable is_instance True if this object is an instance of :class:`.InstanceState`.
Class Variable is_property True if this object is an instance of :class:`.MapperProperty`.
Class Variable is_selectable Return True if this object is an instance of :class:`_expression.Selectable`.
Class Variable _is_internal_proxy True if this object is an internal proxy object.
def __init__(self, property_: Composite[_T], expr: ClauseList): (source)

Construct a new :class:`.Bundle`. e.g.:: bn = Bundle("mybundle", MyClass.x, MyClass.y) for row in session.query(bn).filter( bn.c.x == 5).filter(bn.c.y == 4): print(row.mybundle.x, row.mybundle.y) :param name: name of the bundle. :param \*exprs: columns or SQL expressions comprising the bundle. :param single_entity=False: if True, rows for this :class:`.Bundle` can be returned as a "single entity" outside of any enclosing tuple in the same manner as a mapped entity.

def create_row_processor(self, query: Select[Any], procs: Sequence[Callable[[Row[Any]], Any]], labels: Sequence[str]) -> Callable[[Row[Any]], Any]: (source)

Produce the "row processing" function for this :class:`.Bundle`. May be overridden by subclasses to provide custom behaviors when results are fetched. The method is passed the statement object and a set of "row processor" functions at query execution time; these processor functions when given a result row will return the individual attribute value, which can then be adapted into any kind of return data structure. The example below illustrates replacing the usual :class:`.Row` return structure with a straight Python dictionary:: from sqlalchemy.orm import Bundle class DictBundle(Bundle): def create_row_processor(self, query, procs, labels): 'Override create_row_processor to return values as dictionaries' def proc(row): return dict( zip(labels, (proc(row) for proc in procs)) ) return proc A result from the above :class:`_orm.Bundle` will return dictionary values:: bn = DictBundle('mybundle', MyClass.data1, MyClass.data2) for row in session.execute(select(bn)).where(bn.c.data1 == 'd1'): print(row.mybundle['data1'], row.mybundle['data2'])

property = (source)

Undocumented