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_delete

Signature de la méthode after_bulk_delete

def after_bulk_delete(self, delete_context) 

Description

after_bulk_delete.__doc__

Execute after ORM DELETE against a WHERE expression has been
invoked.

.. container:: event_signatures

     Example argument forms::

        from sqlalchemy import event


        @event.listens_for(SomeSessionOrFactory, 'after_bulk_delete')
        def receive_after_bulk_delete(delete_context):
            "listen for the 'after_bulk_delete' event"

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

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

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

.. deprecated:: 0.9
    The :class:`.SessionEvents.after_bulk_delete` event now accepts the 
    arguments ``delete_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.delete` method.

:param delete_context: a "delete 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.
    * ``result`` the :class:`_engine.CursorResult`
      returned as a result of the
      bulk DELETE operation.

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

.. seealso::

    :meth:`.QueryEvents.before_compile_delete`

    :meth:`.SessionEvents.after_bulk_update`