class documentation

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_compile_state Apply a modification to a given :class:`.ORMCompileState`.
Method process_compile_state_replaced_entities 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_compile_state Undocumented

Inherited from HasCacheKey:

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
Method _gen_cache_key return an optional cache key.
Method _generate_cache_key return a cache key.
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 ORMOption (via HasCacheKey):

Class Variable propagate_to_loaders 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_cached_option_to_uncached_option adapt this option to the "uncached" version of itself in a loader strategy context.
Class Variable _is_core Undocumented
Class Variable _is_criteria_option Undocumented
Class Variable _is_legacy_option Undocumented
Class Variable _is_strategy_option Undocumented
Class Variable _is_user_defined Undocumented

Inherited from ExecutableOption (via HasCacheKey, ORMOption):

Class Variable __visit_name__ Undocumented
Method _clone Create a shallow copy of this ExecutableOption.

Inherited from HasCopyInternals (via HasCacheKey, ORMOption, ExecutableOption):

Method _copy_internals Reassign internal elements to be clones of themselves.

Inherited from HasTraverseInternals (via HasCacheKey, ORMOption, ExecutableOption, HasCopyInternals):

Method get_children Return immediate child :class:`.visitors.HasTraverseInternals` elements of this :class:`.visitors.HasTraverseInternals`.
Class Variable _is_immutable Undocumented
Class Variable _traverse_internals Undocumented
def process_compile_state(self, compile_state: ORMCompileState): (source)

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.

def process_compile_state_replaced_entities(self, compile_state: 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