Execute after an instance is attached to a session. This is called after an add, delete or merge. .. note:: As of 0.8, this event fires off *after* the item has been fully associated with the session, which is different than previous releases. For
(self, session: Session, instance: _O)
| 2058 | |
| 2059 | @_lifecycle_event |
| 2060 | def after_attach(self, session: Session, instance: _O) -> None: |
| 2061 | """Execute after an instance is attached to a session. |
| 2062 | |
| 2063 | This is called after an add, delete or merge. |
| 2064 | |
| 2065 | .. note:: |
| 2066 | |
| 2067 | As of 0.8, this event fires off *after* the item |
| 2068 | has been fully associated with the session, which is |
| 2069 | different than previous releases. For event |
| 2070 | handlers that require the object not yet |
| 2071 | be part of session state (such as handlers which |
| 2072 | may autoflush while the target object is not |
| 2073 | yet complete) consider the |
| 2074 | new :meth:`.before_attach` event. |
| 2075 | |
| 2076 | .. seealso:: |
| 2077 | |
| 2078 | :meth:`~.SessionEvents.before_attach` |
| 2079 | |
| 2080 | :ref:`session_lifecycle_events` |
| 2081 | |
| 2082 | """ |
| 2083 | |
| 2084 | def after_bulk_update(self, update_context: _O) -> None: |
| 2085 | """Event for after the legacy :meth:`_orm.Query.update` method |