summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-04-08 14:15:11 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-04-08 14:15:11 -0400
commita30ffd71b9f5dc6ff2c56a57f45d86f1313df354 (patch)
tree7081ac83bba58360de93470c8a3c269c1a3e1661 /lib/sqlalchemy
parentc6757c32e228f254c8a6a3a192f5305ef243463a (diff)
downloadsqlalchemy-a30ffd71b9f5dc6ff2c56a57f45d86f1313df354.tar.gz
we can load this sum ahead of time, and if there is none, we dont need a per-state/proc for this at all.
this greatly reduces unnecessary crap in the UOW for complex models.
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/dependency.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/sqlalchemy/orm/dependency.py b/lib/sqlalchemy/orm/dependency.py
index d02776dce..98840800f 100644
--- a/lib/sqlalchemy/orm/dependency.py
+++ b/lib/sqlalchemy/orm/dependency.py
@@ -162,6 +162,16 @@ class DependencyProcessor(object):
# now create actions /dependencies for each state.
for state in states:
+ # detect if there's anything changed or loaded
+ # by a preprocessor on this state/attribute. if not,
+ # we should be able to skip it entirely.
+ sum_ = uow.get_attribute_history(
+ state,
+ self.key,
+ passive=True).sum()
+ if not sum_:
+ continue
+
# I'd like to emit the before_delete/after_save actions
# here and have the unit of work not get confused by that
# when it alters the list of dependencies...
@@ -181,15 +191,7 @@ class DependencyProcessor(object):
parent_base_mapper)
if child_in_cycles:
- # locate each child state associated with the parent action,
- # create dependencies for each.
child_actions = []
- sum_ = uow.get_attribute_history(
- state,
- self.key,
- passive=True).sum()
- if not sum_:
- continue
for child_state in sum_:
if child_state is None:
continue