Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Module « sqlalchemy.orm »

Classe « Load »

Informations générales

Héritage

builtins.object
    HasCacheKey
builtins.object
    HasCopyInternals
        ExecutableOption
            ORMOption
                LoaderOption
        builtins.object
            HasMemoized
                Generative
                    Load

Définition

class Load(Generative, LoaderOption):

Description [extrait de Load.__doc__]

Represents loader options which modify the state of a
    :class:`_query.Query` in order to affect how various mapped attributes are
    loaded.

    The :class:`_orm.Load` object is in most cases used implicitly behind the
    scenes when one makes use of a query option like :func:`_orm.joinedload`,
    :func:`.defer`, or similar.   However, the :class:`_orm.Load` object
    can also be used directly, and in some cases can be useful.

    To use :class:`_orm.Load` directly, instantiate it with the target mapped
    class as the argument.   This style of usage is
    useful when dealing with a :class:`_query.Query`
    that has multiple entities::

        myopt = Load(MyClass).joinedload("widgets")

    The above ``myopt`` can now be used with :meth:`_query.Query.options`,
    where it
    will only take effect for the ``MyClass`` entity::

        session.query(MyClass, MyOtherClass).options(myopt)

    One case where :class:`_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.

    .. seealso::

        :ref:`deferred_options`

        :ref:`deferred_loading_w_multiple`

        :ref:`relationship_loader_options`

    

Constructeur(s)

Signature du constructeur Description
__init__(self, entity)

Liste des attributs statiques

Nom de l'attribut Valeur
is_class_strategyFalse
is_opts_onlyFalse
propagate_to_loadersFalse
strategyNone

Liste des opérateurs

Opérateurs hérités de la classe object

__eq__, __ge__, __gt__, __le__, __lt__, __ne__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__getstate__(self)
__setstate__(self, state)
__str__(self)
for_existing_path(path)
options(self, *opts) Apply a series of options as sub-options to this [extrait de options.__doc__]
process_compile_state(self, compile_state)
process_compile_state_replaced_entities(self, compile_state, mapper_entities)
set_class_strategy(self, strategy, opts)
set_column_strategy(self, attrs, strategy, opts=None, opts_only=False)
set_generic_strategy(self, attrs, strategy)
set_relationship_strategy(self, attr, strategy, propagate_to_loaders=True)

Méthodes héritées de la classe LoaderOption

__init_subclass__, __subclasshook__

Méthodes héritées de la classe HasMemoized

memoized_attribute, memoized_instancemethod

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__