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 ? Calcul scientifique
avec Python
Voir le programme détaillé
Module « sqlalchemy »

Classe « Result »

Informations générales

Héritage

    builtins.object
        Generic
builtins.object
    HasMemoized
        InPlaceGenerative
            ResultInternal
        builtins.object
            _WithKeys
                Result

Définition

class Result(_WithKeys, ResultInternal):

help(Result)

Represent a set of database results.

.. versionadded:: 1.4  The :class:`_engine.Result` object provides a
   completely updated usage model and calling facade for SQLAlchemy
   Core and SQLAlchemy ORM.   In Core, it forms the basis of the
   :class:`_engine.CursorResult` object which replaces the previous
   :class:`_engine.ResultProxy` interface.   When using the ORM, a
   higher level object called :class:`_engine.ChunkedIteratorResult`
   is normally used.

.. note:: In SQLAlchemy 1.4 and above, this object is
   used for ORM results returned by :meth:`_orm.Session.execute`, which can
   yield instances of ORM mapped objects either individually or within
   tuple-like rows. Note that the :class:`_engine.Result` object does not
   deduplicate instances or rows automatically as is the case with the
   legacy :class:`_orm.Query` object. For in-Python de-duplication of
   instances or rows, use the :meth:`_engine.Result.unique` modifier
   method.

.. seealso::

    :ref:`tutorial_fetching_rows` - in the :doc:`/tutorial/index`

Constructeur(s)

Signature du constructeur Description
__init__(self, cursor_metadata: 'ResultMetaData')

Liste des propriétés

Nom de la propriétéDescription
closedreturn ``True`` if this :class:`_engine.Result` reports .closed [extrait de closed.__doc__]
tApply a "typed tuple" typing filter to returned rows. [extrait de t.__doc__]

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
__class_getitem__ Parameterizes a generic class. [extrait de __class_getitem__.__doc__]
__enter__(self) -> 'Self'
__exit__(self, type_: 'Any', value: 'Any', traceback: 'Any') -> 'None'
__iter__(self) -> 'Iterator[Row[_TP]]'
__next__(self) -> 'Row[_TP]'
all(self) -> 'Sequence[Row[_TP]]' Return all rows in a sequence. [extrait de all.__doc__]
close(self) -> 'None' close this :class:`_engine.Result`. [extrait de close.__doc__]
columns(self, *col_expressions: '_KeyIndexType') -> 'Self' Establish the columns that should be returned in each row. [extrait de columns.__doc__]
fetchall(self) -> 'Sequence[Row[_TP]]' A synonym for the :meth:`_engine.Result.all` method. [extrait de fetchall.__doc__]
fetchmany(self, size: 'Optional[int]' = None) -> 'Sequence[Row[_TP]]' Fetch many rows. [extrait de fetchmany.__doc__]
fetchone(self) -> 'Optional[Row[_TP]]' Fetch one row. [extrait de fetchone.__doc__]
first(self) -> 'Optional[Row[_TP]]' Fetch the first row or ``None`` if no row is present. [extrait de first.__doc__]
freeze(self) -> 'FrozenResult[_TP]' Return a callable object that will produce copies of this [extrait de freeze.__doc__]
mappings(self) -> 'MappingResult' Apply a mappings filter to returned rows, returning an instance of [extrait de mappings.__doc__]
merge(self, *others: 'Result[Any]') -> 'MergedResult[_TP]' Merge this :class:`_engine.Result` with other compatible result [extrait de merge.__doc__]
one(self) -> 'Row[_TP]' Return exactly one row or raise an exception. [extrait de one.__doc__]
one_or_none(self) -> 'Optional[Row[_TP]]' Return at most one result or raise an exception. [extrait de one_or_none.__doc__]
partitions(self, size: 'Optional[int]' = None) -> 'Iterator[Sequence[Row[_TP]]]' Iterate through sub-lists of rows of the size given. [extrait de partitions.__doc__]
scalar(self) -> 'Any' Fetch the first column of the first row, and close the result set. [extrait de scalar.__doc__]
scalar_one(self) -> 'Any' Return exactly one scalar result or raise an exception. [extrait de scalar_one.__doc__]
scalar_one_or_none(self) -> 'Optional[Any]' Return exactly one scalar result or ``None``. [extrait de scalar_one_or_none.__doc__]
scalars(self, index: '_KeyIndexType' = 0) -> 'ScalarResult[Any]' Return a :class:`_engine.ScalarResult` filtering object which [extrait de scalars.__doc__]
tuples(self) -> 'TupleResult[_TP]' Apply a "typed tuple" typing filter to returned rows. [extrait de tuples.__doc__]
unique(self, strategy: 'Optional[_UniqueFilterType]' = None) -> 'Self' Apply unique filtering to the objects returned by this [extrait de unique.__doc__]
yield_per(self, num: 'int') -> 'Self' Configure the row-fetching strategy to fetch ``num`` rows at a time. [extrait de yield_per.__doc__]

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

__init_subclass__, __subclasshook__

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

memoized_attribute, memoized_instancemethod

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

keys

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

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

Vous êtes un professionnel et vous avez besoin d'une formation ? Mise en oeuvre d'IHM
avec Qt et PySide6
Voir le programme détaillé