summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/sqlalchemy/orm/__init__.py8
-rw-r--r--lib/sqlalchemy/orm/attributes.py11
-rw-r--r--lib/sqlalchemy/orm/strategies.py1
-rw-r--r--test/orm/test_unitofwork.py12
4 files changed, 11 insertions, 21 deletions
diff --git a/lib/sqlalchemy/orm/__init__.py b/lib/sqlalchemy/orm/__init__.py
index d2f5de2b9..97149d97f 100644
--- a/lib/sqlalchemy/orm/__init__.py
+++ b/lib/sqlalchemy/orm/__init__.py
@@ -651,11 +651,9 @@ def composite(class_, *cols, **kwargs):
:param active_history=False:
When ``True``, indicates that the "previous" value for a
scalar attribute should be loaded when replaced, if not
- already loaded. Note that attributes generated by
- :func:`.composite` properties load the "previous" value
- in any case, however this is being changed in 0.7,
- so the flag is introduced here for forwards compatibility.
- (new in 0.6.6)
+ already loaded. See the same flag on :func:`.column_property`.
+ (This flag becomes meaningful specifically for
+ :func:`.composite` in 0.7 - previously it was a placeholder).
:param group:
A group name for this property when marked as deferred.
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py
index 86f950813..9ae885bf9 100644
--- a/lib/sqlalchemy/orm/attributes.py
+++ b/lib/sqlalchemy/orm/attributes.py
@@ -488,16 +488,7 @@ class MutableScalarAttributeImpl(ScalarAttributeImpl):
state.mutable_dict.pop(self.key)
def set(self, state, dict_, value, initiator, passive=PASSIVE_OFF):
- if initiator and initiator.parent_token is self.parent_token:
- return
-
- if self.dispatch.on_set:
- old = self.get(state, dict_)
- value = self.fire_replace_event(state, dict_,
- value, old, initiator)
-
- state.modified_event(dict_, self, True, NEVER_SET)
- dict_[self.key] = value
+ ScalarAttributeImpl.set(self, state, dict_, value, initiator, passive)
state.mutable_dict[self.key] = value
diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py
index 1411216f2..d8d4afc37 100644
--- a/lib/sqlalchemy/orm/strategies.py
+++ b/lib/sqlalchemy/orm/strategies.py
@@ -166,6 +166,7 @@ class CompositeColumnLoader(ColumnLoader):
compare_function=compare,
copy_function=copy,
mutable_scalars=True,
+ active_history=self.parent_property.active_history,
)
def create_row_processor(self, selectcontext, path, mapper,
diff --git a/test/orm/test_unitofwork.py b/test/orm/test_unitofwork.py
index d20aada6f..511adde82 100644
--- a/test/orm/test_unitofwork.py
+++ b/test/orm/test_unitofwork.py
@@ -410,8 +410,8 @@ class MutableTypesTest(_base.MappedTest):
@testing.resolve_artifact_names
def test_expire_attribute_set(self):
- """test one SELECT emitted when assigning to an expired
- mutable attribute - this will become 0 in 0.7.
+ """test no SELECT emitted when assigning to an expired
+ mutable attribute.
"""
@@ -423,7 +423,7 @@ class MutableTypesTest(_base.MappedTest):
assert 'data' not in f1.__dict__
def go():
f1.data = pickleable.Bar(10, 15)
- self.sql_count_(1, go)
+ self.sql_count_(0, go)
session.commit()
eq_(f1.data.x, 10)
@@ -448,8 +448,8 @@ class MutableTypesTest(_base.MappedTest):
@testing.resolve_artifact_names
def test_deferred_attribute_set(self):
- """test one SELECT emitted when assigning to a deferred
- mutable attribute - this will become 0 in 0.7.
+ """test no SELECT emitted when assigning to a deferred
+ mutable attribute.
"""
sa.orm.clear_mappers()
@@ -467,7 +467,7 @@ class MutableTypesTest(_base.MappedTest):
f1 = session.query(Foo).first()
def go():
f1.data = pickleable.Bar(10, 15)
- self.sql_count_(1, go)
+ self.sql_count_(0, go)
session.commit()
eq_(f1.data.x, 10)