- Query.select_from(), from_statement() ensure
that the given argument is a FromClause,
or Text/Select/Union, respectively.
+
+ - Fixed bug introduced in 0.5rc4 involving eager
+ loading not functioning for properties which were
+ added to a mapper post-compile using
+ add_property() or equivalent.
- Duplicate items in a list-based collection will
be maintained when issuing INSERTs to
else:
return mappers, self._selectable_from_mappers(mappers)
- @util.memoized_property
+ @property
def _default_polymorphic_properties(self):
return util.unique_list(
chain(*[list(mapper.iterate_properties) for mapper in [self] + self._with_polymorphic_mappers])
assert [User(id=7, addresses=[Address(id=1, email_address='jack@bean.com')])] == q.filter(User.id==7).all()
assert self.static.user_address_result == q.all()
+ @testing.resolve_artifact_names
+ def test_late_compile(self):
+ m = mapper(User, users)
+ sess = create_session()
+ sess.query(User).all()
+ m.add_property("addresses", relation(mapper(Address, addresses)))
+
+ sess.clear()
+ def go():
+ eq_(
+ [User(id=7, addresses=[Address(id=1, email_address='jack@bean.com')])],
+ sess.query(User).options(eagerload('addresses')).filter(User.id==7).all()
+ )
+ self.assert_sql_count(testing.db, go, 1)
+
+
@testing.resolve_artifact_names
def test_no_orphan(self):
"""An eagerly loaded child object is not marked as an orphan"""