Receive a class and mapper when the :class:`_orm.Mapper` has been fully constructed. This event is called after the initial constructor for :class:`_orm.Mapper` completes. This occurs after the :meth:`_orm.MapperEvents.instrument_class` event and after the :
(
self, mapper: Mapper[_O], class_: Type[_O]
)
| 943 | """ |
| 944 | |
| 945 | def after_mapper_constructed( |
| 946 | self, mapper: Mapper[_O], class_: Type[_O] |
| 947 | ) -> None: |
| 948 | """Receive a class and mapper when the :class:`_orm.Mapper` has been |
| 949 | fully constructed. |
| 950 | |
| 951 | This event is called after the initial constructor for |
| 952 | :class:`_orm.Mapper` completes. This occurs after the |
| 953 | :meth:`_orm.MapperEvents.instrument_class` event and after the |
| 954 | :class:`_orm.Mapper` has done an initial pass of its arguments |
| 955 | to generate its collection of :class:`_orm.MapperProperty` objects, |
| 956 | which are accessible via the :meth:`_orm.Mapper.get_property` |
| 957 | method and the :attr:`_orm.Mapper.iterate_properties` attribute. |
| 958 | |
| 959 | This event differs from the |
| 960 | :meth:`_orm.MapperEvents.before_mapper_configured` event in that it |
| 961 | is invoked within the constructor for :class:`_orm.Mapper`, rather |
| 962 | than within the :meth:`_orm.registry.configure` process. Currently, |
| 963 | this event is the only one which is appropriate for handlers that |
| 964 | wish to create additional mapped classes in response to the |
| 965 | construction of this :class:`_orm.Mapper`, which will be part of the |
| 966 | same configure step when :meth:`_orm.registry.configure` next runs. |
| 967 | |
| 968 | .. versionadded:: 2.0.2 |
| 969 | |
| 970 | .. seealso:: |
| 971 | |
| 972 | :ref:`examples_versioning` - an example which illustrates the use |
| 973 | of the :meth:`_orm.MapperEvents.before_mapper_configured` |
| 974 | event to create new mappers to record change-audit histories on |
| 975 | objects. |
| 976 | |
| 977 | """ |
| 978 | |
| 979 | @event._omit_standard_example |
| 980 | def before_mapper_configured( |
no outgoing calls