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 :

Classe « SessionEvents »

Méthode sqlalchemy.orm.SessionEvents.after_bulk_update

Signature de la méthode after_bulk_update

def after_bulk_update(self, update_context) 

Description

after_bulk_update.__doc__

Execute after an ORM UPDATE against a WHERE expression has been
invoked.

.. container:: event_signatures

     Example argument forms::

        from sqlalchemy import event


        @event.listens_for(SomeSessionOrFactory, 'after_bulk_update')
        def receive_after_bulk_update(update_context):
            "listen for the 'after_bulk_update' event"

            # ... (event handling logic) ...

        # DEPRECATED calling style (pre-0.9, will be removed in a future release)
        @event.listens_for(SomeSessionOrFactory, 'after_bulk_update')
        def receive_after_bulk_update(session, query, query_context, result):
            "listen for the 'after_bulk_update' event"

            # ... (event handling logic) ...

.. deprecated:: 0.9
    The :class:`.SessionEvents.after_bulk_update` event now accepts the 
    arguments ``update_context``.
    Support for listener functions which accept the previous 
    argument signature(s) listed above as "deprecated" will be 
    removed in a future release.

This is called as a result of the :meth:`_query.Query.update` method.

:param update_context: an "update context" object which contains
 details about the update, including these attributes:

    * ``session`` - the :class:`.Session` involved
    * ``query`` -the :class:`_query.Query`
      object that this update operation
      was called upon.
    * ``values`` The "values" dictionary that was passed to
      :meth:`_query.Query.update`.
    * ``result`` the :class:`_engine.CursorResult`
      returned as a result of the
      bulk UPDATE operation.

.. versionchanged:: 1.4 the update_context no longer has a
   ``QueryContext`` object associated with it.

.. seealso::

    :meth:`.QueryEvents.before_compile_update`

    :meth:`.SessionEvents.after_bulk_delete`