From 770e1ddc1338f5b4ca603bd273b985955bd65126 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 24 Jan 2010 22:50:58 +0000 Subject: - Connection has execution_options(), generative method which accepts keywords that affect how the statement is executed w.r.t. the DBAPI. Currently supports "stream_results", causes psycopg2 to use a server side cursor for that statement. Can also be set upon select() and text() constructs directly as well as ORM Query(). --- lib/sqlalchemy/sql/expression.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/sqlalchemy/sql/expression.py') diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index f2ad4351a..eb64fd571 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -2194,16 +2194,13 @@ class _Executable(object): _execution_options = util.frozendict() @_generative - def execution_options(self, **kwargs): + def execution_options(self, **kw): """ Set non-SQL options for the statement, such as dialect-specific options. The options available are covered in the respective dialect's section. """ - _execution_options = self._execution_options.copy() - for key, value in kwargs.items(): - _execution_options[key] = value - self._execution_options = _execution_options + self._execution_options = self._execution_options.union(kw) class _TextClause(_Executable, ClauseElement): @@ -2252,6 +2249,11 @@ class _TextClause(_Executable, ClauseElement): else: return None + def _generate(self): + s = self.__class__.__new__(self.__class__) + s.__dict__ = self.__dict__.copy() + return s + def _copy_internals(self, clone=_clone): self.bindparams = dict((b.key, clone(b)) for b in self.bindparams.values()) -- cgit v1.2.1