module documentation

private module containing functions used to convert database rows into object instances and associated state. the functions here are called primarily by Query, Mapper, as well as some of the attribute loading strategies.

Class PostLoad Track loaders and states for "post load" operations.
Function get_from_identity Look up the given key in the given session's identity map, check the object for expired state if found.
Function instances Return a :class:`.Result` given an ORM query context.
Function load_on_ident Load the given identity key from the database.
Function load_on_pk_identity Load the given primary key identity from the database.
Function load_scalar_attributes initiate a column-based attribute refresh operation.
Function merge_frozen_result Merge a :class:`_engine.FrozenResult` back into a :class:`_orm.Session`, returning a new :class:`_engine.Result` object with :term:`persistent` objects.
Function merge_result Merge a result into the given :class:`.Query` object's Session.
Function _decorate_polymorphic_switch Undocumented
Function _instance_processor Produce a mapper level row processor callable which processes rows into mapped instances.
Function _load_subclass_via_in Undocumented
Function _populate_full Undocumented
Function _populate_partial Undocumented
Function _set_get_options Undocumented
Function _setup_entity_query Undocumented
Function _validate_version_id Undocumented
Function _warn_for_runid_changed Undocumented
Type Variable _O Undocumented
Type Variable _T Undocumented
Type Alias _PopulatorDict Undocumented
Variable _new_runid Undocumented
def get_from_identity(session: Session, mapper: Mapper[_O], key: _IdentityKeyType[_O], passive: PassiveFlag) -> Union[LoaderCallableStatus, Optional[_O]]: (source)

Look up the given key in the given session's identity map, check the object for expired state if found.

def instances(cursor: CursorResult[Any], context: QueryContext) -> Result[Any]: (source)

Return a :class:`.Result` given an ORM query context. :param cursor: a :class:`.CursorResult`, generated by a statement which came from :class:`.ORMCompileState` :param context: a :class:`.QueryContext` object :return: a :class:`.Result` object representing ORM results .. versionchanged:: 1.4 The instances() function now uses :class:`.Result` objects and has an all new interface.

def load_on_ident(session: Session, statement: Union[Select, FromStatement], key: Optional[_IdentityKeyType], *, load_options: Optional[Sequence[ORMOption]] = None, refresh_state: Optional[InstanceState[Any]] = None, with_for_update: Optional[ForUpdateArg] = None, only_load_props: Optional[Iterable[str]] = None, no_autoflush: bool = False, bind_arguments: Mapping[str, Any] = util.EMPTY_DICT, execution_options: _ExecuteOptions = util.EMPTY_DICT, require_pk_cols: bool = False, is_user_refresh: bool = False): (source)

Load the given identity key from the database.

def load_on_pk_identity(session: Session, statement: Union[Select, FromStatement], primary_key_identity: Optional[Tuple[Any, ...]], *, load_options: Optional[Sequence[ORMOption]] = None, refresh_state: Optional[InstanceState[Any]] = None, with_for_update: Optional[ForUpdateArg] = None, only_load_props: Optional[Iterable[str]] = None, identity_token: Optional[Any] = None, no_autoflush: bool = False, bind_arguments: Mapping[str, Any] = util.EMPTY_DICT, execution_options: _ExecuteOptions = util.EMPTY_DICT, require_pk_cols: bool = False, is_user_refresh: bool = False): (source)

Load the given primary key identity from the database.

def load_scalar_attributes(mapper, state, attribute_names, passive): (source)

initiate a column-based attribute refresh operation.

@util.preload_module('sqlalchemy.orm.context')
def merge_frozen_result(session, statement, frozen_result, load=True): (source)

Merge a :class:`_engine.FrozenResult` back into a :class:`_orm.Session`, returning a new :class:`_engine.Result` object with :term:`persistent` objects. See the section :ref:`do_orm_execute_re_executing` for an example. .. seealso:: :ref:`do_orm_execute_re_executing` :meth:`_engine.Result.freeze` :class:`_engine.FrozenResult`

@util.became_legacy_20(':func:`_orm.merge_result`', alternative='The function as well as the method on :class:`_orm.Query` is superseded by the :func:`_orm.merge_frozen_result` function.')
@util.preload_module('sqlalchemy.orm.context')
def merge_result(query: Query[Any], iterator: Union[FrozenResult, Iterable[Sequence[Any]], Iterable[object]], load: bool = True) -> Union[FrozenResult, Iterable[Any]]: (source)

Merge a result into the given :class:`.Query` object's Session. See :meth:`_orm.Query.merge_result` for top-level documentation on this function.

def _decorate_polymorphic_switch(instance_fn, context, query_entity, mapper, result, path, polymorphic_discriminator, adapter, ensure_no_pk): (source)

Undocumented

def _instance_processor(query_entity, mapper, context, result, path, adapter, only_load_props=None, refresh_state=None, polymorphic_discriminator=None, _polymorphic_from=None): (source)

Produce a mapper level row processor callable which processes rows into mapped instances.

def _load_subclass_via_in(context, path, entity, polymorphic_from, option_entities): (source)

Undocumented

def _populate_full(context, row, state, dict_, isnew, load_path, loaded_instance, populate_existing, populators): (source)

Undocumented

def _populate_partial(context, row, state, dict_, isnew, load_path, unloaded, populators): (source)

Undocumented

def _set_get_options(compile_opt, load_opt, populate_existing=None, version_check=None, only_load_props=None, refresh_state=None, identity_token=None, is_user_refresh=None): (source)

Undocumented

def _setup_entity_query(compile_state, mapper, query_entity, path, adapter, column_collection, with_polymorphic=None, only_load_props=None, polymorphic_discriminator=None, **kw): (source)

Undocumented

def _validate_version_id(mapper, state, dict_, row, getter): (source)

Undocumented

def _warn_for_runid_changed(state): (source)

Undocumented

Undocumented

Value
TypeVar('_O',
        bound=object)

Undocumented

Value
TypeVar('_T',
        bound=Any)
_PopulatorDict = (source)

Undocumented

Value
Dict[str, List[Tuple[str, Any]]]
_new_runid = (source)

Undocumented