.. changelog::
:version: 0.9.4
+ .. change::
+ :tags: bug, orm
+
+ Fixed regression from 0.8 where using an option like
+ :func:`.orm.lazyload` with the "wildcard" expression, e.g. ``"*"``,
+ would raise an assertion error in the case where the query didn't
+ contain any actual entities. This assertion is meant for other cases
+ and was catching this one inadvertently.
+
.. change::
:tags: bug, examples
"Wildcard loader can only be used with exactly "
"one entity. Use Load(ent) to specify "
"specific entities.")
+ elif token.endswith(_DEFAULT_TOKEN):
+ raiseerr = False
for ent in query._mapper_entities:
# return only the first _MapperEntity when searching
sess.query(User).options, opt
)
+ def test_global_star_ignored_no_entities_unbound(self):
+ sess = self._downgrade_fixture()
+ User = self.classes.User
+ opt = sa.orm.lazyload('*')
+ q = sess.query(User.name).options(opt)
+ eq_(q.all(), [(u'jack',), (u'ed',), (u'fred',), (u'chuck',)])
+
+ def test_global_star_ignored_no_entities_bound(self):
+ sess = self._downgrade_fixture()
+ User = self.classes.User
+ opt = sa.orm.Load(User).lazyload('*')
+ q = sess.query(User.name).options(opt)
+ eq_(q.all(), [(u'jack',), (u'ed',), (u'fred',), (u'chuck',)])
+
def test_select_with_joinedload(self):
"""Mapper load strategy defaults can be downgraded with
lazyload('*') option, while explicit joinedload() option