options incorrectly, thereby breaking subsequent usage of the
:meth:`.Query.execution_options` method. Courtesy Ryan Kelly.
[ticket:2661]
.. changelog::
:version: 0.8.0
+ .. change::
+ :tags: bug, orm
+ :tickets: 2661
+
+ Fixed bug whereby :meth:`.Query.yield_per` would set the execution
+ options incorrectly, thereby breaking subsequent usage of the
+ :meth:`.Query.execution_options` method. Courtesy Ryan Kelly.
+
.. change::
:tags: bug, orm
:tickets: 1768
"""
self._yield_per = count
- self._execution_options = self._execution_options.copy()
- self._execution_options['stream_results'] = True
+ self._execution_options = self._execution_options.union(
+ {"stream_results": True})
def get(self, ident):
"""Return an instance based on the given primary key identifier,
except StopIteration:
pass
+ def test_yield_per_and_execution_options(self):
+ User = self.classes.User
+
+ sess = create_session()
+ q = sess.query(User).yield_per(1)
+ q = q.execution_options(foo='bar')
+ assert q._yield_per
+ eq_(q._execution_options, {"stream_results": True, "foo": "bar"})
+
+
+
class HintsTest(QueryTest, AssertsCompiledSQL):
def test_hints(self):
User = self.classes.User