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é
Classe « Query »

Méthode sqlalchemy.orm.Query.merge_result

Signature de la méthode merge_result

def merge_result(self, iterator: 'Union[FrozenResult[Any], Iterable[Sequence[Any]], Iterable[object]]', load: 'bool' = True) -> 'Union[FrozenResult[Any], Iterable[Any]]' 

Description

help(Query.merge_result)

Merge a result into this :class:`_query.Query` object's Session.

.. deprecated:: 2.0 The :meth:`_orm.Query.merge_result` method is considered legacy as of the 1.x series of SQLAlchemy and becomes a legacy construct in 2.0. The method is superseded by the :func:`_orm.merge_frozen_result` function. (Background on SQLAlchemy 2.0 at: :ref:`migration_20_toplevel`)

Given an iterator returned by a :class:`_query.Query`
of the same structure
as this one, return an identical iterator of results, with all mapped
instances merged into the session using :meth:`.Session.merge`. This
is an optimized method which will merge all mapped instances,
preserving the structure of the result rows and unmapped columns with
less method overhead than that of calling :meth:`.Session.merge`
explicitly for each value.

The structure of the results is determined based on the column list of
this :class:`_query.Query` - if these do not correspond,
unchecked errors
will occur.

The 'load' argument is the same as that of :meth:`.Session.merge`.

For an example of how :meth:`_query.Query.merge_result` is used, see
the source code for the example :ref:`examples_caching`, where
:meth:`_query.Query.merge_result` is used to efficiently restore state
from a cache back into a target :class:`.Session`.



Vous êtes un professionnel et vous avez besoin d'une formation ? Calcul scientifique
avec Python
Voir le programme détaillé