class documentation

class CompileStateOption(HasCacheKey, ORMOption):

Known subclasses: sqlalchemy.orm.interfaces.CriteriaOption, sqlalchemy.orm.interfaces.LoaderOption

View In Hierarchy

base for .ORMOption classes that affect the compilation of a SQL query and therefore need to be part of the cache key.

Note

.CompileStateOption is generally non-public and should not be used as a base class for user-defined options; instead, use .UserDefinedOption, which is easier to use as it does not interact with ORM compilation internals or caching.

.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 .HasCacheKey and need to provide robust _cache_key_traversal structures.

The .CompileStateOption class is used to implement the ORM .LoaderOption and .CriteriaOption classes.

New in version 1.4.28.
Method process​_compile​_state Apply a modification to a given .CompileState.
Method process​_compile​_state​_replaced​_entities Apply a modification to a given .CompileState, given entities that were replaced by with_only_columns() or with_entities().
Class Variable ​_is​_compile​_state Undocumented

Inherited from HasCacheKey:

Class Variable inherit​_cache Indicate if this .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 __slots__ 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:

Class Variable __slots__ Undocumented
Class Variable ​_is​_criteria​_option Undocumented
Class Variable ​_is​_legacy​_option Undocumented
Class Variable ​_is​_strategy​_option Undocumented
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.

Inherited from ExecutableOption (via ORMOption):

Method ​_clone Create a shallow copy of this ExecutableOption.
Class Variable __visit​_name__ Undocumented
Class Variable ​_is​_has​_cache​_key Undocumented

Inherited from HasCopyInternals (via ORMOption, ExecutableOption):

Method ​_copy​_internals Reassign internal elements to be clones of themselves.
def process_compile_state(self, compile_state):
Apply a modification to a given .CompileState.
def process_compile_state_replaced_entities(self, compile_state, mapper_entities):

Apply a modification to a given .CompileState, given entities that were replaced by with_only_columns() or with_entities().

New in version 1.4.19.
_is_compile_state: bool =