MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / refresh_flush

Method refresh_flush

lib/sqlalchemy/orm/events.py:523–568  ·  view source on GitHub ↗

Receive an object instance after one or more attributes that contain a column-level default or onupdate handler have been refreshed during persistence of the object's state. This event is the same as :meth:`.InstanceEvents.refresh` except it is invoked within the uni

(
        self,
        target: _O,
        flush_context: UOWTransaction,
        attrs: Optional[Iterable[str]],
    )

Source from the content-addressed store, hash-verified

521 """
522
523 def refresh_flush(
524 self,
525 target: _O,
526 flush_context: UOWTransaction,
527 attrs: Optional[Iterable[str]],
528 ) -> None:
529 """Receive an object instance after one or more attributes that
530 contain a column-level default or onupdate handler have been refreshed
531 during persistence of the object's state.
532
533 This event is the same as :meth:`.InstanceEvents.refresh` except
534 it is invoked within the unit of work flush process, and includes
535 only non-primary-key columns that have column level default or
536 onupdate handlers, including Python callables as well as server side
537 defaults and triggers which may be fetched via the RETURNING clause.
538
539 .. note::
540
541 While the :meth:`.InstanceEvents.refresh_flush` event is triggered
542 for an object that was INSERTed as well as for an object that was
543 UPDATEd, the event is geared primarily towards the UPDATE process;
544 it is mostly an internal artifact that INSERT actions can also
545 trigger this event, and note that **primary key columns for an
546 INSERTed row are explicitly omitted** from this event. In order to
547 intercept the newly INSERTed state of an object, the
548 :meth:`.SessionEvents.pending_to_persistent` and
549 :meth:`.MapperEvents.after_insert` are better choices.
550
551 :param target: the mapped instance. If
552 the event is configured with ``raw=True``, this will
553 instead be the :class:`.InstanceState` state-management
554 object associated with the instance.
555 :param flush_context: Internal :class:`.UOWTransaction` object
556 which handles the details of the flush.
557 :param attrs: sequence of attribute names which
558 were populated.
559
560 .. seealso::
561
562 :ref:`mapped_class_load_events`
563
564 :ref:`orm_server_defaults`
565
566 :ref:`metadata_defaults_toplevel`
567
568 """
569
570 def expire(self, target: _O, attrs: Optional[Iterable[str]]) -> None:
571 """Receive an object instance after its attributes or some subset

Calls

no outgoing calls