diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-08-05 21:46:24 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-08-05 21:46:24 -0400 |
| commit | 4b4f8fbf25f1a5a76c1579c1a3fd6ffad07c8c66 (patch) | |
| tree | e658c89e6f2909bc936a262938d4539388583b9a /lib/sqlalchemy/orm | |
| parent | de1f8f8345ecd6af0ec1177703465e9471cfe862 (diff) | |
| download | sqlalchemy-4b4f8fbf25f1a5a76c1579c1a3fd6ffad07c8c66.tar.gz | |
- modernize orm.reconstructor documentation a bit
Change-Id: Ied786e8f9ad78f524be03a382d002dada7dd218b
Diffstat (limited to 'lib/sqlalchemy/orm')
| -rw-r--r-- | lib/sqlalchemy/orm/events.py | 5 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/mapper.py | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/events.py b/lib/sqlalchemy/orm/events.py index 1d1c347b1..9c837446d 100644 --- a/lib/sqlalchemy/orm/events.py +++ b/lib/sqlalchemy/orm/events.py @@ -302,6 +302,9 @@ class InstanceEvents(event.Events): attributes and collections may or may not be loaded or even initialized, depending on what's present in the result rows. + The :meth:`.InstanceEvents.load` event is also available in a + class-method decorator format called :func:`.orm.reconstructor`. + :param target: the mapped instance. If the event is configured with ``raw=True``, this will instead be the :class:`.InstanceState` state-management @@ -319,6 +322,8 @@ class InstanceEvents(event.Events): :meth:`.SessionEvents.loaded_as_persistent` + :ref:`mapping_constructors` + """ def refresh(self, target, context, attrs): diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index 6998a4c57..d102618a2 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -3014,6 +3014,12 @@ def reconstructor(fn): this stage will not be recorded for the next flush() operation, so the activity within a reconstructor should be conservative. + .. seealso:: + + :ref:`mapping_constructors` + + :meth:`.InstanceEvents.load` + """ fn.__sa_reconstructor__ = True return fn |
