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]
)
| 920 | """ |
| 921 | |
| 922 | def after_mapper_constructed( |
| 923 | self, mapper: Mapper[_O], class_: Type[_O] |
| 924 | ) -> None: |
| 925 | """Receive a class and mapper when the :class:`_orm.Mapper` has been |
| 926 | fully constructed. |
| 927 | |
| 928 | This event is called after the initial constructor for |
| 929 | :class:`_orm.Mapper` completes. This occurs after the |
| 930 | :meth:`_orm.MapperEvents.instrument_class` event and after the |
| 931 | :class:`_orm.Mapper` has done an initial pass of its arguments |
| 932 | to generate its collection of :class:`_orm.MapperProperty` objects, |
| 933 | which are accessible via the :meth:`_orm.Mapper.get_property` |
| 934 | method and the :attr:`_orm.Mapper.iterate_properties` attribute. |
| 935 | |
| 936 | This event differs from the |
| 937 | :meth:`_orm.MapperEvents.before_mapper_configured` event in that it |
| 938 | is invoked within the constructor for :class:`_orm.Mapper`, rather |
| 939 | than within the :meth:`_orm.registry.configure` process. Currently, |
| 940 | this event is the only one which is appropriate for handlers that |
| 941 | wish to create additional mapped classes in response to the |
| 942 | construction of this :class:`_orm.Mapper`, which will be part of the |
| 943 | same configure step when :meth:`_orm.registry.configure` next runs. |
| 944 | |
| 945 | .. versionadded:: 2.0.2 |
| 946 | |
| 947 | .. seealso:: |
| 948 | |
| 949 | :ref:`examples_versioning` - an example which illustrates the use |
| 950 | of the :meth:`_orm.MapperEvents.before_mapper_configured` |
| 951 | event to create new mappers to record change-audit histories on |
| 952 | objects. |
| 953 | |
| 954 | """ |
| 955 | |
| 956 | @event._omit_standard_example |
| 957 | def before_mapper_configured( |
no outgoing calls