class ORMOption(ExecutableOption): (source)
Known subclasses: sqlalchemy.ext.horizontal_shard.set_shard_id
, sqlalchemy.orm.interfaces.CompileStateOption
, sqlalchemy.orm.interfaces.MapperOption
, sqlalchemy.orm.interfaces.UserDefinedOption
Base class for option objects that are passed to ORM queries. These options may be consumed by :meth:`.Query.options`, :meth:`.Select.options`, or in a more general sense by any :meth:`.Executable.options` method. They are interpreted at statement compile time or execution time in modern use. The deprecated :class:`.MapperOption` is consumed at ORM query construction time. .. versionadded:: 1.4
Class Variable | __slots__ |
Undocumented |
Class 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. |
Method | _adapt |
adapt this option to the "uncached" version of itself in a loader strategy context. |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Inherited from ExecutableOption
:
Class Variable | __visit |
Undocumented |
Method | _clone |
Create a shallow copy of this ExecutableOption. |
Class Variable | _is |
Undocumented |
Inherited from HasCopyInternals
(via ExecutableOption
):
Method | _copy |
Reassign internal elements to be clones of themselves. |
Inherited from HasTraverseInternals
(via ExecutableOption
, HasCopyInternals
):
Method | get |
Return immediate child :class:`.visitors.HasTraverseInternals` elements of this :class:`.visitors.HasTraverseInternals`. |
Class Variable | _is |
Undocumented |
Class Variable | _traverse |
Undocumented |
sqlalchemy.ext.horizontal_shard.set_shard_id
, sqlalchemy.orm.interfaces.MapperOption
, sqlalchemy.orm.interfaces.UserDefinedOption
, sqlalchemy.orm.util.LoaderCriteriaOption
, sqlalchemy.orm.strategy_options._AbstractLoad
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)
¶
sqlalchemy.orm.strategy_options.Load
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