summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-08-25 08:53:32 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-08-25 08:53:32 -0400
commit439f2813e00de00aefb0905bbf52337f7ddcc7d3 (patch)
treeb51832ce319fd91803d820f6124e4416a6409c31 /lib
parentb80d54e7b24ef30498c0ab8b3951781b33a0fcd9 (diff)
downloadsqlalchemy-439f2813e00de00aefb0905bbf52337f7ddcc7d3.tar.gz
add more discouragment from using before_/after_ mapper events for anything ORM-heavy
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/orm/events.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/events.py b/lib/sqlalchemy/orm/events.py
index a8162fa72..913d764da 100644
--- a/lib/sqlalchemy/orm/events.py
+++ b/lib/sqlalchemy/orm/events.py
@@ -581,6 +581,14 @@ class MapperEvents(event.Events):
into individual (and more poorly performing)
event->persist->event steps.
+ Handlers should **not** alter mapped attributes on the objects
+ just flushed or on other objects of the same class, nor
+ should any other ORM-based operation such as :class:`.Session.add`
+ take place here. Attribute changes on objects that were
+ already flushed will be discarded, and changes to the flush
+ plan will also not take place. Use :meth:`.Session.before_flush`
+ to change the flush plan on flush.
+
:param mapper: the :class:`.Mapper` which is the target
of this event.
:param connection: the :class:`.Connection` being used to
@@ -689,6 +697,14 @@ class MapperEvents(event.Events):
(and more poorly performing) event->persist->event
steps.
+ Handlers should **not** alter mapped attributes on the objects
+ just flushed or on other objects of the same class, nor
+ should any other ORM-based operation such as :class:`.Session.add`
+ take place here. Attribute changes on objects that were
+ already flushed will be discarded, and changes to the flush
+ plan will also not take place. Use :meth:`.Session.before_flush`
+ to change the flush plan on flush.
+
:param mapper: the :class:`.Mapper` which is the target
of this event.
:param connection: the :class:`.Connection` being used to
@@ -749,6 +765,14 @@ class MapperEvents(event.Events):
same class after their DELETE statements have been emitted at
once in a previous step.
+ Handlers should **not** alter mapped attributes on the objects
+ just flushed or on other objects of the same class, nor
+ should any other ORM-based operation such as :class:`.Session.add`
+ take place here. Attribute changes on objects that were
+ already flushed will be discarded, and changes to the flush
+ plan will also not take place. Use :meth:`.Session.before_flush`
+ to change the flush plan on flush.
+
:param mapper: the :class:`.Mapper` which is the target
of this event.
:param connection: the :class:`.Connection` being used to