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 ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé
Classe « AttributeEvents »

Méthode sqlalchemy.orm.AttributeEvents.append

Signature de la méthode append

def append(self, target: '_O', value: '_T', initiator: 'Event', *, key: 'EventConstants' = <EventConstants.NO_KEY: 4>) -> 'Optional[_T]' 

Description

help(AttributeEvents.append)

Receive a collection append event.

.. container:: event_signatures

     Example argument forms::

        from sqlalchemy import event


        @event.listens_for(SomeClass.some_attribute, 'append')
        def receive_append(target, value, initiator):
            "listen for the 'append' event"

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


The append event is invoked for each element as it is appended
to the collection.  This occurs for single-item appends as well
as for a "bulk replace" operation.

:param target: the object instance receiving the event.
  If the listener is registered with ``raw=True``, this will
  be the :class:`.InstanceState` object.
:param value: the value being appended.  If this listener
  is registered with ``retval=True``, the listener
  function must return this value, or a new value which
  replaces it.
:param initiator: An instance of :class:`.attributes.Event`
  representing the initiation of the event.  May be modified
  from its original value by backref handlers in order to control
  chained event propagation, as well as be inspected for information
  about the source of the event.
:param key: When the event is established using the
 :paramref:`.AttributeEvents.include_key` parameter set to
 True, this will be the key used in the operation, such as
 ``collection[some_key_or_index] = value``.
 The parameter is not passed
 to the event at all if the the
 :paramref:`.AttributeEvents.include_key`
 was not used to set up the event; this is to allow backwards
 compatibility with existing event handlers that don't include the
 ``key`` parameter.

 .. versionadded:: 2.0

:return: if the event was registered with ``retval=True``,
 the given value, or a new effective value, should be returned.

.. seealso::

    :class:`.AttributeEvents` - background on listener options such
    as propagation to subclasses.

    :meth:`.AttributeEvents.bulk_replace`



Vous êtes un professionnel et vous avez besoin d'une formation ? RAG (Retrieval-Augmented Generation)
et Fine Tuning d'un LLM
Voir le programme détaillé