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]],
)
| 541 | """ |
| 542 | |
| 543 | def refresh_flush( |
| 544 | self, |
| 545 | target: _O, |
| 546 | flush_context: UOWTransaction, |
| 547 | attrs: Optional[Iterable[str]], |
| 548 | ) -> None: |
| 549 | """Receive an object instance after one or more attributes that |
| 550 | contain a column-level default or onupdate handler have been refreshed |
| 551 | during persistence of the object's state. |
| 552 | |
| 553 | This event is the same as :meth:`.InstanceEvents.refresh` except |
| 554 | it is invoked within the unit of work flush process, and includes |
| 555 | only non-primary-key columns that have column level default or |
| 556 | onupdate handlers, including Python callables as well as server side |
| 557 | defaults and triggers which may be fetched via the RETURNING clause. |
| 558 | |
| 559 | .. note:: |
| 560 | |
| 561 | While the :meth:`.InstanceEvents.refresh_flush` event is triggered |
| 562 | for an object that was INSERTed as well as for an object that was |
| 563 | UPDATEd, the event is geared primarily towards the UPDATE process; |
| 564 | it is mostly an internal artifact that INSERT actions can also |
| 565 | trigger this event, and note that **primary key columns for an |
| 566 | INSERTed row are explicitly omitted** from this event. In order to |
| 567 | intercept the newly INSERTed state of an object, the |
| 568 | :meth:`.SessionEvents.pending_to_persistent` and |
| 569 | :meth:`.MapperEvents.after_insert` are better choices. |
| 570 | |
| 571 | :param target: the mapped instance. If |
| 572 | the event is configured with ``raw=True``, this will |
| 573 | instead be the :class:`.InstanceState` state-management |
| 574 | object associated with the instance. |
| 575 | :param flush_context: Internal :class:`.UOWTransaction` object |
| 576 | which handles the details of the flush. |
| 577 | :param attrs: sequence of attribute names which |
| 578 | were populated. |
| 579 | |
| 580 | .. seealso:: |
| 581 | |
| 582 | :ref:`mapped_class_load_events` |
| 583 | |
| 584 | :ref:`orm_server_defaults` |
| 585 | |
| 586 | :ref:`metadata_defaults_toplevel` |
| 587 | |
| 588 | """ |
| 589 | |
| 590 | def expire(self, target: _O, attrs: Optional[Iterable[str]]) -> None: |
| 591 | """Receive an object instance after its attributes or some subset |
no outgoing calls