Called before a series of mappers have been configured. The :meth:`.MapperEvents.before_configured` event is invoked each time the :func:`_orm.configure_mappers` function is invoked, before the function has done any of its work. :func:`_orm.configure_mappers` is typi
(self)
| 1082 | |
| 1083 | @event._omit_standard_example |
| 1084 | def before_configured(self) -> None: |
| 1085 | """Called before a series of mappers have been configured. |
| 1086 | |
| 1087 | The :meth:`.MapperEvents.before_configured` event is invoked |
| 1088 | each time the :func:`_orm.configure_mappers` function is |
| 1089 | invoked, before the function has done any of its work. |
| 1090 | :func:`_orm.configure_mappers` is typically invoked |
| 1091 | automatically as mappings are first used, as well as each time |
| 1092 | new mappers have been made available and new mapper use is |
| 1093 | detected. |
| 1094 | |
| 1095 | Similar events to this one include |
| 1096 | :meth:`.MapperEvents.after_configured`, which is invoked after a series |
| 1097 | of mappers has been configured, as well as |
| 1098 | :meth:`.MapperEvents.before_mapper_configured` and |
| 1099 | :meth:`.MapperEvents.mapper_configured`, which are both invoked on a |
| 1100 | per-mapper basis. |
| 1101 | |
| 1102 | This event can **only** be applied to the :class:`_orm.Mapper` class, |
| 1103 | and not to individual mappings or mapped classes:: |
| 1104 | |
| 1105 | from sqlalchemy.orm import Mapper |
| 1106 | |
| 1107 | |
| 1108 | @event.listens_for(Mapper, "before_configured") |
| 1109 | def go(): ... |
| 1110 | |
| 1111 | Typically, this event is called once per application, but in practice |
| 1112 | may be called more than once, any time new mappers are to be affected |
| 1113 | by a :func:`_orm.configure_mappers` call. If new mappings are |
| 1114 | constructed after existing ones have already been used, this event will |
| 1115 | likely be called again. |
| 1116 | |
| 1117 | .. seealso:: |
| 1118 | |
| 1119 | :meth:`.MapperEvents.before_mapper_configured` |
| 1120 | |
| 1121 | :meth:`.MapperEvents.mapper_configured` |
| 1122 | |
| 1123 | :meth:`.MapperEvents.after_configured` |
| 1124 | |
| 1125 | """ |
| 1126 | |
| 1127 | @event._omit_standard_example |
| 1128 | def after_configured(self) -> None: |
no outgoing calls