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 :

Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé
Module « sqlalchemy.orm »

Fonction defaultload - module sqlalchemy.orm

Signature de la fonction defaultload

def defaultload(*keys: '_AttrType') -> '_AbstractLoad' 

Description

help(sqlalchemy.orm.defaultload)

Indicate an attribute should load using its predefined loader style.

The behavior of this loading option is to not change the current
loading style of the attribute, meaning that the previously configured
one is used or, if no previous style was selected, the default
loading will be used.

This method is used to link to other loader options further into
a chain of attributes without altering the loader style of the links
along the chain.  For example, to set joined eager loading for an
element of an element::

    session.query(MyClass).options(
        defaultload(MyClass.someattribute).joinedload(
            MyOtherClass.someotherattribute
        )
    )

:func:`.defaultload` is also useful for setting column-level options on
a related class, namely that of :func:`.defer` and :func:`.undefer`::

    session.scalars(
        select(MyClass).options(
            defaultload(MyClass.someattribute)
            .defer("some_column")
            .undefer("some_other_column")
        )
    )

.. seealso::

    :ref:`orm_queryguide_relationship_sub_options`

    :meth:`_orm.Load.options`



Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé