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

Méthode sqlalchemy.orm.scoped_session.execute

Signature de la méthode execute

def execute(self, statement: 'Executable', params: 'Optional[_CoreAnyExecuteParams]' = None, *, execution_options: 'OrmExecuteOptionsParameter' = immutabledict({}), bind_arguments: 'Optional[_BindArguments]' = None, _parent_execute_state: 'Optional[Any]' = None, _add_event: 'Optional[Any]' = None) -> 'Result[Any]' 

Description

help(scoped_session.execute)

Execute a SQL expression construct.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class on
    behalf of the :class:`_orm.scoping.scoped_session` class.

Returns a :class:`_engine.Result` object representing
results of the statement execution.

E.g.::

    from sqlalchemy import select

    result = session.execute(select(User).where(User.id == 5))

The API contract of :meth:`_orm.Session.execute` is similar to that
of :meth:`_engine.Connection.execute`, the :term:`2.0 style` version
of :class:`_engine.Connection`.

.. versionchanged:: 1.4 the :meth:`_orm.Session.execute` method is
   now the primary point of ORM statement execution when using
   :term:`2.0 style` ORM usage.

:param statement:
    An executable statement (i.e. an :class:`.Executable` expression
    such as :func:`_expression.select`).

:param params:
    Optional dictionary, or list of dictionaries, containing
    bound parameter values.   If a single dictionary, single-row
    execution occurs; if a list of dictionaries, an
    "executemany" will be invoked.  The keys in each dictionary
    must correspond to parameter names present in the statement.

:param execution_options: optional dictionary of execution options,
 which will be associated with the statement execution.  This
 dictionary can provide a subset of the options that are accepted
 by :meth:`_engine.Connection.execution_options`, and may also
 provide additional options understood only in an ORM context.

 .. seealso::

    :ref:`orm_queryguide_execution_options` - ORM-specific execution
    options

:param bind_arguments: dictionary of additional arguments to determine
 the bind.  May include "mapper", "bind", or other custom arguments.
 Contents of this dictionary are passed to the
 :meth:`.Session.get_bind` method.

:return: a :class:`_engine.Result` object.





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