class documentation

class _UnboundLoad(Load):

View In Hierarchy

Represent a loader option that isn't tied to a root entity.

The loader option will produce an entity-linked _orm.Load object when it is passed _query.Query.options.

This provides compatibility with the traditional system of freestanding options, e.g. joinedload('x.y.z').

Class Method ​_from​_keys Undocumented
Method __getstate__ Undocumented
Method __init__ Undocumented
Method __setstate__ Undocumented
Method ​_apply​_to​_parent Undocumented
Method ​_bind​_loader Convert from an _UnboundLoad() object into a Load() object.
Method ​_chop​_path Undocumented
Method ​_deep​_clone Undocumented
Method ​_find​_entity​_basestring Undocumented
Method ​_find​_entity​_prop​_comparator Undocumented
Method ​_gen​_cache​_key Inlined gen_cache_key
Method ​_generate​_path Undocumented
Method ​_process Undocumented
Method ​_serialize​_path Undocumented
Method ​_set​_path​_strategy Undocumented
Class Variable ​_is​_chain​_link Undocumented
Instance Variable __dict__ Undocumented
Instance Variable ​_extra​_criteria Undocumented
Instance Variable ​_to​_bind Undocumented
Instance Variable local​_opts Undocumented
Instance Variable path Undocumented
Instance 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 Load:

Class Method for​_existing​_path Undocumented
Method __str__ Undocumented
Method ​_adjust​_for​_extra​_criteria Apply the current bound parameters in a QueryContext to all occurrences "extra_criteria" stored within al this Load object; copying in place.
Method ​_clone​_for​_bind​_strategy No summary
Method ​_coerce​_strat Undocumented
Method ​_generate Undocumented
Method ​_generate​_extra​_criteria Apply the current bound parameters in a QueryContext to the immediate "extra_criteria" stored with this Load object.
Method ​_set​_for​_path Undocumented
Method options Apply a series of options as sub-options to this _orm.Load object.
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().
Method set​_class​_strategy Undocumented
Method set​_column​_strategy Undocumented
Method set​_generic​_strategy Undocumented
Method set​_relationship​_strategy Undocumented
Class Variable ​_cache​_key​_traversal Undocumented
Class Variable ​_is​_strategy​_option Undocumented
Class Variable is​_opts​_only Undocumented
Class Variable strategy Undocumented
Instance Variable ​_of​_type Undocumented
Instance Variable context Undocumented
Instance Variable is​_class​_strategy Undocumented
Property ​_context​_cache​_key Undocumented

Inherited from CompileStateOption (via Load, LoaderOption):

Class Variable ​_is​_compile​_state Undocumented

Inherited from HasCacheKey (via Load, LoaderOption, CompileStateOption):

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 ​_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 (via Load, LoaderOption, CompileStateOption):

Class Variable __slots__ Undocumented
Class Variable ​_is​_criteria​_option Undocumented
Class Variable ​_is​_legacy​_option Undocumented

Inherited from ExecutableOption (via Load, LoaderOption, CompileStateOption, 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 Load, LoaderOption, CompileStateOption, ORMOption, ExecutableOption):

Method ​_copy​_internals Reassign internal elements to be clones of themselves.
@classmethod
def _from_keys(cls, meth, keys, chained, kw):

Undocumented

def __getstate__(self):
def __init__(self):
def __setstate__(self, state):
def _apply_to_parent(self, parent, applied, bound, to_bind=None):
def _bind_loader(self, entities, current_path, context, raiseerr):

Convert from an _UnboundLoad() object into a Load() object.

The _UnboundLoad() uses an informal "path" and does not necessarily refer to a lead entity as it may use string tokens. The Load() OTOH refers to a complete path. This method reconciles from a given Query into a Load.

Example:

query = session.query(User).options(
    joinedload("orders").joinedload("items"))

The above options will be an _UnboundLoad object along the lines of (note this is not the exact API of _UnboundLoad):

_UnboundLoad(
    _to_bind=[
        _UnboundLoad(["orders"], {"lazy": "joined"}),
        _UnboundLoad(["orders", "items"], {"lazy": "joined"}),
    ]
)

After this method, we get something more like this (again this is not exact API):

Load(
    User,
    (User, User.orders.property))
Load(
    User,
    (User, User.orders.property, Order, Order.items.property))
def _chop_path(self, to_chop, path):
def _deep_clone(self, applied, process):
def _find_entity_basestring(self, entities, token, raiseerr):

Undocumented

def _find_entity_prop_comparator(self, entities, prop, mapper, raiseerr):

Undocumented

def _gen_cache_key(self, anon_map, bindparams, _unbound_option_seen=None):

Inlined gen_cache_key

Original traversal is:

_cache_key_traversal = [
    ("path", visitors.ExtendedInternalTraversal.dp_multi_list),
    ("strategy", visitors.ExtendedInternalTraversal.dp_plain_obj),
    (
        "_to_bind",
        visitors.ExtendedInternalTraversal.dp_has_cache_key_list,
    ),
    (
        "_extra_criteria",
        visitors.InternalTraversal.dp_clauseelement_list),
    (
        "local_opts",
        visitors.ExtendedInternalTraversal.dp_string_multi_dict,
    ),
]

The inlining is so that the "_to_bind" list can be flattened to not repeat the same UnboundLoad options over and over again.

See #6869

def _generate_path(self, path, attr, for_strategy, wildcard_key):
def _process(self, compile_state, mapper_entities, raiseerr):
def _serialize_path(self, path, filter_aliased_class=False):

Undocumented

def _set_path_strategy(self):
_is_chain_link: bool =

Undocumented

__dict__ =

Undocumented

_extra_criteria =
_to_bind =

Undocumented

local_opts: dict =
path =
propagate_to_loaders: bool =
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.