class Load(_AbstractLoad): (source)
Represents loader options which modify the state of a ORM-enabled :class:`_sql.Select` or a legacy :class:`_query.Query` in order to affect how various mapped attributes are loaded. The :class:`_orm.Load` object is in most cases used implicitly behind the scenes when one makes use of a query option like :func:`_orm.joinedload`, :func:`_orm.defer`, or similar. It typically is not instantiated directly except for in some very specific cases. .. seealso:: :ref:`orm_queryguide_relationship_per_entity_wildcard` - illustrates an example where direct use of :class:`_orm.Load` may be useful
Method | __getstate__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __setstate__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | options |
Apply a series of options as sub-options to this :class:`_orm.Load` object. |
Class Variable | __slots__ |
Undocumented |
Instance Variable | context |
Undocumented |
Instance Variable | path |
Undocumented |
Instance Variable | propagate |
if True, indicate this option should be carried along to "secondary" SELECT statements that occur for relationship lazy loaders as well as attribute load / refresh operations. |
Class Method | _construct |
Undocumented |
Method | _adapt |
adapt this option to the "uncached" version of itself in a loader strategy context. |
Method | _adjust |
Apply the current bound parameters in a QueryContext to all occurrences "extra_criteria" stored within this ``Load`` object, returning a new instance of this ``Load`` object. |
Method | _apply |
apply this :class:`_orm.Load` object as a sub-option of another :class:`_orm.Load` object. |
Method | _clone |
Undocumented |
Method | _process |
implemented by subclasses |
Method | _reconcile |
called at process time to allow adjustment of the root entity inside of _LoadElement objects. |
Class Variable | _cache |
Undocumented |
Class Variable | _traverse |
Undocumented |
Inherited from _AbstractLoad
:
Method | contains |
Indicate that the given attribute should be eagerly loaded from columns stated manually in the query. |
Method | defaultload |
Indicate an attribute should load using its default loader style. |
Method | defer |
Indicate that the given column-oriented attribute should be deferred, e.g. not loaded until accessed. |
Method | immediateload |
Indicate that the given attribute should be loaded using an immediate load with a per-attribute SELECT statement. |
Method | joinedload |
Indicate that the given attribute should be loaded using joined eager loading. |
Method | lazyload |
Indicate that the given attribute should be loaded using "lazy" loading. |
Method | load |
Indicate that for a particular entity, only the given list of column-based attribute names should be loaded; all others will be deferred. |
Method | noload |
Indicate that the given relationship attribute should remain unloaded. |
Method | process |
Apply a modification to a given :class:`.ORMCompileState`. |
Method | process |
Apply a modification to a given :class:`.ORMCompileState`, given entities that were replaced by with_only_columns() or with_entities(). |
Method | raiseload |
Indicate that the given attribute should raise an error if accessed. |
Method | selectin |
Indicate an eager load should take place for all attributes specific to a subclass. |
Method | selectinload |
Indicate that the given attribute should be loaded using SELECT IN eager loading. |
Method | subqueryload |
Indicate that the given attribute should be loaded using subquery eager loading. |
Method | undefer |
Indicate that the given column-oriented attribute should be undeferred, e.g. specified within the SELECT statement of the entity as a whole. |
Method | undefer |
Indicate that columns within the given deferred group name should be undeferred. |
Method | with |
Apply an ad-hoc SQL expression to a "deferred expression" attribute. |
Class Method | _chop |
Undocumented |
Method | _coerce |
Undocumented |
Method | _set |
Undocumented |
Method | _set |
Undocumented |
Method | _set |
Undocumented |
Method | _set |
Undocumented |
Class Variable | _is |
Undocumented |
Inherited from GenerativeOnTraversal
(via _AbstractLoad
):
Method | _generate |
Undocumented |
Inherited from HasShallowCopy
(via _AbstractLoad
, GenerativeOnTraversal
):
Class Method | _generate |
Undocumented |
Class Method | _generate |
Undocumented |
Class Method | _generate |
Undocumented |
Method | _clone |
Create a shallow copy |
Method | _generated |
Undocumented |
Method | _generated |
Undocumented |
Method | _generated |
Undocumented |
Method | _shallow |
Undocumented |
Method | _shallow |
Undocumented |
Method | _shallow |
Undocumented |
Inherited from CompileStateOption
(via _AbstractLoad
, GenerativeOnTraversal
, HasShallowCopy
, LoaderOption
):
Class Variable | _is |
Undocumented |
Inherited from HasCacheKey
(via _AbstractLoad
, GenerativeOnTraversal
, HasShallowCopy
, LoaderOption
, CompileStateOption
):
Class Variable | inherit |
Indicate if this :class:`.HasCacheKey` instance should make use of the cache key generation scheme used by its immediate superclass. |
Class Method | _generate |
generate cache key dispatcher for a new class. |
Class Method | _generate |
Undocumented |
Method | _gen |
return an optional cache key. |
Method | _generate |
return a cache key. |
Class Variable | _generated |
Undocumented |
Class Variable | _hierarchy |
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 |
Undocumented |
Inherited from ORMOption
(via _AbstractLoad
, GenerativeOnTraversal
, HasShallowCopy
, LoaderOption
, CompileStateOption
, HasCacheKey
):
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Inherited from ExecutableOption
(via _AbstractLoad
, GenerativeOnTraversal
, HasShallowCopy
, LoaderOption
, CompileStateOption
, HasCacheKey
, ORMOption
):
Class Variable | __visit |
Undocumented |
Inherited from HasCopyInternals
(via _AbstractLoad
, GenerativeOnTraversal
, HasShallowCopy
, LoaderOption
, CompileStateOption
, HasCacheKey
, ORMOption
, ExecutableOption
):
Method | _copy |
Reassign internal elements to be clones of themselves. |
Inherited from HasTraverseInternals
(via _AbstractLoad
, GenerativeOnTraversal
, HasShallowCopy
, LoaderOption
, CompileStateOption
, HasCacheKey
, ORMOption
, ExecutableOption
, HasCopyInternals
):
Method | get |
Return immediate child :class:`.visitors.HasTraverseInternals` elements of this :class:`.visitors.HasTraverseInternals`. |
Class Variable | _is |
Undocumented |
Apply a series of options as sub-options to this :class:`_orm.Load` object. E.g.:: query = session.query(Author) query = query.options( joinedload(Author.book).options( load_only(Book.summary, Book.excerpt), joinedload(Book.citations).options( joinedload(Citation.author) ) ) ) :param \*opts: A series of loader option objects (ultimately :class:`_orm.Load` objects) which should be applied to the path specified by this :class:`_orm.Load` object. .. versionadded:: 1.3.6 .. seealso:: :func:`.defaultload` :ref:`orm_queryguide_relationship_sub_options`
if True, indicate this option should be carried along to "secondary" SELECT statements that occur for relationship lazy loaders as well as attribute load / refresh operations.
QueryContext
, uncached_opt: ORMOption
) -> ORMOption
:
(source)
¶
adapt this option to the "uncached" version of itself in a loader strategy context. given "self" which is an option from a cached query, as well as the corresponding option from the uncached version of the same query, return the option we should use in a new query, in the context of a loader strategy being asked to load related rows on behalf of that cached query, which is assumed to be building a new query based on entities passed to us from the cached query. Currently this routine chooses between "self" and "uncached" without manufacturing anything new. If the option is itself a loader strategy option which has a path, that path needs to match to the entities being passed to us by the cached query, so the :class:`_orm.Load` subclass overrides this to return "self". For all other options, we return the uncached form which may have changing state, such as a with_loader_criteria() option which will very often have new state. This routine could in the future involve generating a new option based on both inputs if use cases arise, such as if with_loader_criteria() needed to match up to ``AliasedClass`` instances given in the parent query. However, longer term it might be better to restructure things such that ``AliasedClass`` entities are always matched up on their cache key, instead of identity, in things like paths and such, so that this whole issue of "the uncached option does not match the entities" goes away. However this would make ``PathRegistry`` more complicated and difficult to debug as well as potentially less performant in that it would be hashing enormous cache keys rather than a simple AliasedInsp. UNLESS, we could get cache keys overall to be reliably hashed into something like an md5 key. .. versionadded:: 1.4.41
Apply the current bound parameters in a QueryContext to all occurrences "extra_criteria" stored within this ``Load`` object, returning a new instance of this ``Load`` object.
apply this :class:`_orm.Load` object as a sub-option of another :class:`_orm.Load` object. This method is used by the :meth:`_orm.Load.options` method.
Optional[ Tuple[ _AttrType, ...]]
, strategy: Optional[ _StrategyKey]
, wildcard_key: Optional[ _WildcardKeyType]
, opts: Optional[ _OptsType]
= None, attr_group: Optional[ _AttrGroupType]
= None, propagate_to_loaders: bool
= True, reconcile_to_other: Optional[ bool]
= None) -> Self
:
(source)
¶
Undocumented
ORMCompileState
, mapper_entities: Sequence[ _MapperEntity]
, raiseerr: bool
):
(source)
¶
implemented by subclasses