summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-01-24 22:50:58 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2010-01-24 22:50:58 +0000
commit770e1ddc1338f5b4ca603bd273b985955bd65126 (patch)
treef84cf04dc070382169ce98037d90fe3233a132d4 /lib/sqlalchemy/sql
parentd3e49722d19068ccc6cdd577748b4b8df158db9c (diff)
downloadsqlalchemy-770e1ddc1338f5b4ca603bd273b985955bd65126.tar.gz
- 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().
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/expression.py12
1 files changed, 7 insertions, 5 deletions
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())