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 ? Deep Learning avec Python
et Keras et Tensorflow
Voir le programme détaillé
Module « sqlalchemy.orm »

Fonction contains_eager - module sqlalchemy.orm

Signature de la fonction contains_eager

def contains_eager(*keys: '_AttrType', **kw: 'Any') -> '_AbstractLoad' 

Description

help(sqlalchemy.orm.contains_eager)

Indicate that the given attribute should be eagerly loaded from
columns stated manually in the query.

This function is part of the :class:`_orm.Load` interface and supports
both method-chained and standalone operation.

The option is used in conjunction with an explicit join that loads
the desired rows, i.e.::

    sess.query(Order).join(Order.user).options(contains_eager(Order.user))

The above query would join from the ``Order`` entity to its related
``User`` entity, and the returned ``Order`` objects would have the
``Order.user`` attribute pre-populated.

It may also be used for customizing the entries in an eagerly loaded
collection; queries will normally want to use the
:ref:`orm_queryguide_populate_existing` execution option assuming the
primary collection of parent objects may already have been loaded::

    sess.query(User).join(User.addresses).filter(
        Address.email_address.like("%@aol.com")
    ).options(contains_eager(User.addresses)).populate_existing()

See the section :ref:`contains_eager` for complete usage details.

.. seealso::

    :ref:`loading_toplevel`

    :ref:`contains_eager`



Vous êtes un professionnel et vous avez besoin d'une formation ? RAG (Retrieval-Augmented Generation)
et Fine Tuning d'un LLM
Voir le programme détaillé