class Load(Generative, LoaderOption):
Known subclasses: sqlalchemy.orm.strategy_options._UnboundLoad
Represents loader options which modify the state of a
_query.Query
in order to affect how various mapped attributes are
loaded.
The _orm.Load
object is in most cases used implicitly behind the
scenes when one makes use of a query option like _orm.joinedload
,
.defer
, or similar. However, the _orm.Load
object
can also be used directly, and in some cases can be useful.
To use _orm.Load
directly, instantiate it with the target mapped
class as the argument. This style of usage is
useful when dealing with a _query.Query
that has multiple entities:
myopt = Load(MyClass).joinedload("widgets")
The above myopt can now be used with _query.Query.options
,
where it
will only take effect for the MyClass entity:
session.query(MyClass, MyOtherClass).options(myopt)
One case where _orm.Load
is useful as public API is when specifying
"wildcard" options that only take effect for a certain class:
session.query(Order).options(Load(Order).lazyload('*'))
Above, all relationships on Order will be lazy-loaded, but other attributes on those descendant objects will load using their normal loader strategy.
Class Method | for_existing_path |
Undocumented |
Method | __getstate__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __setstate__ |
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 | _apply_to_parent |
Undocumented |
Method | _chop_path |
Undocumented |
Method | _clone_for_bind_strategy |
No summary |
Method | _coerce_strat |
Undocumented |
Method | _deep_clone |
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 | _generate_path |
Undocumented |
Method | _process |
Undocumented |
Method | _set_for_path |
Undocumented |
Method | _set_path_strategy |
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 | _extra_criteria |
Undocumented |
Instance Variable | _of_type |
Undocumented |
Instance Variable | context |
Undocumented |
Instance Variable | is_class_strategy |
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. |
Property | _context_cache_key |
Undocumented |
Inherited from CompileStateOption
(via LoaderOption
):
Class Variable | _is_compile_state |
Undocumented |
Inherited from HasCacheKey
(via 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 | _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
(via LoaderOption
, CompileStateOption
):
Class Variable | __slots__ |
Undocumented |
Class Variable | _is_criteria_option |
Undocumented |
Class Variable | _is_legacy_option |
Undocumented |
Inherited from ExecutableOption
(via 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 LoaderOption
, CompileStateOption
, ORMOption
, ExecutableOption
):
Method | _copy_internals |
Reassign internal elements to be clones of themselves. |
sqlalchemy.orm.strategy_options._UnboundLoad
Undocumented
sqlalchemy.orm.strategy_options._UnboundLoad
Undocumented
sqlalchemy.orm.strategy_options._UnboundLoad
Undocumented
sqlalchemy.orm.strategy_options._UnboundLoad
Undocumented
Apply the current bound parameters in a QueryContext to the immediate "extra_criteria" stored with this Load object.
Load objects are typically pulled from the cached version of the statement from a QueryContext. The statement currently being executed will have new values (and keys) for bound parameters in the extra criteria which need to be applied by loader strategies when they handle this criteria for a result set.
sqlalchemy.orm.strategy_options._UnboundLoad
Undocumented
sqlalchemy.orm.strategy_options._UnboundLoad
Undocumented
sqlalchemy.orm.strategy_options._UnboundLoad
Undocumented
Apply a series of options as sub-options to this
_orm.Load
object.
E.g.:
query = session.query(Author) query = query.options( joinedload(Author.book).options( load_only(Book.summary, Book.excerpt), joinedload(Book.citations).options( joinedload(Citation.author) ) ) )
Parameters | |
*opts | A series of loader option objects (ultimately
_orm.Load objects) which should be applied to the path
specified by this _orm.Load object. |
Apply a modification to a given .CompileState
,
given entities that were replaced by with_only_columns() or
with_entities().
sqlalchemy.orm.strategy_options._UnboundLoad