summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-09-05 15:23:44 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-09-05 15:23:44 +0000
commit0fbb67b71a91a1c6f792812474f45a52333aa227 (patch)
treee093752e5e52335d71b3b6a7ea5395309b8149eb /lib/sqlalchemy/orm
parentf432bd3550443fb27711e463b086deae7c3096df (diff)
downloadsqlalchemy-0fbb67b71a91a1c6f792812474f45a52333aa227.tar.gz
synchronize inherited does not need to be called for the full mapper hierarchy
Diffstat (limited to 'lib/sqlalchemy/orm')
-rw-r--r--lib/sqlalchemy/orm/mapper.py15
-rw-r--r--lib/sqlalchemy/orm/query.py4
2 files changed, 9 insertions, 10 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py
index d6dbc2634..a13e9feb3 100644
--- a/lib/sqlalchemy/orm/mapper.py
+++ b/lib/sqlalchemy/orm/mapper.py
@@ -1223,12 +1223,12 @@ class Mapper(object):
mapper.__postfetch(uowtransaction, connection, table, state, c, c.last_inserted_params(), value_params)
# synchronize newly inserted ids from one table to the next
- # TODO: this fires off more than needed, try to organize syncrules
- # per table
- for m in reversed(list(mapper.iterate_to_root())):
- if m.__inherits_equated_pairs:
- m.__synchronize_inherited(state)
-
+ # TODO: this performs some unnecessary attribute transfers
+ # from an attribute to itself, since the attribute is often mapped
+ # to multiple, equivalent columns
+ if mapper.__inherits_equated_pairs:
+ sync.populate(state, mapper, state, mapper, mapper.__inherits_equated_pairs)
+
# testlib.pragma exempt:__hash__
inserted_objects.add((state, connection))
@@ -1259,9 +1259,6 @@ class Mapper(object):
if 'after_update' in mapper.extension.methods:
mapper.extension.after_update(mapper, connection, state.obj())
- def __synchronize_inherited(self, state):
- sync.populate(state, self, state, self, self.__inherits_equated_pairs)
-
def __postfetch(self, uowtransaction, connection, table, state, resultproxy, params, value_params):
"""For a given Table that has just been inserted/updated,
mark as 'expired' those attributes which correspond to columns
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py
index d02432c26..cb0935f42 100644
--- a/lib/sqlalchemy/orm/query.py
+++ b/lib/sqlalchemy/orm/query.py
@@ -267,7 +267,9 @@ class Query(object):
return equivs
def __no_criterion_condition(self, meth):
- if self._criterion or self._statement or self._from_obj or self._limit is not None or self._offset is not None or self._group_by or self._order_by:
+ if self._criterion or self._statement or self._from_obj or \
+ self._limit is not None or self._offset is not None or \
+ self._group_by or self._order_by:
raise sa_exc.InvalidRequestError("Query.%s() being called on a Query with existing criterion. " % meth)
self._statement = self._criterion = self._from_obj = None