class CompileStateOption(HasCacheKey, ORMOption): (source)
Known subclasses: sqlalchemy.orm.interfaces.CriteriaOption
, sqlalchemy.orm.interfaces.LoaderOption
base for :class:`.ORMOption` classes that affect the compilation of a SQL query and therefore need to be part of the cache key. .. note:: :class:`.CompileStateOption` is generally non-public and should not be used as a base class for user-defined options; instead, use :class:`.UserDefinedOption`, which is easier to use as it does not interact with ORM compilation internals or caching. :class:`.CompileStateOption` defines an internal attribute ``_is_compile_state=True`` which has the effect of the ORM compilation routines for SELECT and other statements will call upon these options when a SQL string is being compiled. As such, these classes implement :class:`.HasCacheKey` and need to provide robust ``_cache_key_traversal`` structures. The :class:`.CompileStateOption` class is used to implement the ORM :class:`.LoaderOption` and :class:`.CriteriaOption` classes. .. versionadded:: 1.4.28
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(). |
Class Variable | __slots__ |
Undocumented |
Class Variable | _is |
Undocumented |
Inherited from HasCacheKey
:
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 HasCacheKey
):
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 |
Inherited from ExecutableOption
(via HasCacheKey
, ORMOption
):
Class Variable | __visit |
Undocumented |
Method | _clone |
Create a shallow copy of this ExecutableOption. |
Inherited from HasCopyInternals
(via HasCacheKey
, ORMOption
, ExecutableOption
):
Method | _copy |
Reassign internal elements to be clones of themselves. |
Inherited from HasTraverseInternals
(via HasCacheKey
, ORMOption
, 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.orm.query.AliasOption
, sqlalchemy.orm.util.LoaderCriteriaOption
, sqlalchemy.orm.strategy_options._AbstractLoad
Apply a modification to a given :class:`.ORMCompileState`. This method is part of the implementation of a particular :class:`.CompileStateOption` and is only invoked internally when an ORM query is compiled.
ORMCompileState
, mapper_entities: Sequence[ _MapperEntity]
):
(source)
¶
Apply a modification to a given :class:`.ORMCompileState`, given entities that were replaced by with_only_columns() or with_entities(). This method is part of the implementation of a particular :class:`.CompileStateOption` and is only invoked internally when an ORM query is compiled. .. versionadded:: 1.4.19