- Fixed primary key update for many-to-many collections where
the collection had not been loaded yet [ticket:1127]
+ - Fixed bug whereby deferred() columns with a group in conjunction
+ with an otherwise unrelated synonym() would produce
+ an AttributeError during deferred load.
+
- The before_flush() hook on SessionExtension takes place before
the list of new/dirty/deleted is calculated for the final
time, allowing routines within before_flush() to further
from sqlalchemy.orm import mapper, attributes
from sqlalchemy.orm.interfaces import (
LoaderStrategy, StrategizedOption, MapperOption, PropertyOption,
- serialize_path, deserialize_path
+ serialize_path, deserialize_path, StrategizedProperty
)
from sqlalchemy.orm import session as sessionlib
from sqlalchemy.orm import util as mapperutil
if self.keys:
toload = self.keys
elif strategy.group:
- toload = [p.key for p in localparent.iterate_properties if isinstance(p.strategy, DeferredColumnLoader) and p.group==strategy.group]
+ toload = [
+ p.key for p in
+ localparent.iterate_properties
+ if isinstance(p, StrategizedProperty) and
+ isinstance(p.strategy, DeferredColumnLoader) and
+ p.group==strategy.group
+ ]
else:
toload = [self.key]
o.description = "some description"
self.sql_count_(0, go)
+ @testing.resolve_artifact_names
+ def test_synonym_group_bug(self):
+ mapper(Order, orders, properties={
+ 'isopen':synonym('_isopen', map_column=True),
+ 'description':deferred(orders.c.description, group='foo')
+ })
+
+ sess = create_session()
+ o1 = sess.query(Order).get(1)
+ eq_(o1.description, "order 1")
+
@testing.resolve_artifact_names
def test_unsaved_2(self):
mapper(Order, orders, properties={