summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-04-07 13:42:31 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-04-07 13:42:31 -0400
commit822a6b57869e0091f439125ef9593b6c55af8352 (patch)
treece29bd83161d12b818d2935badc45696ec00b941 /lib/sqlalchemy/engine/base.py
parent736682a589014f83d437c275e2ce4b21f4f86aa8 (diff)
downloadsqlalchemy-822a6b57869e0091f439125ef9593b6c55af8352.tar.gz
- Fixed bug in execution_options() feature whereby the existing
Transaction and other state information from the parent connection would not be propagated to the sub-connection.
Diffstat (limited to 'lib/sqlalchemy/engine/base.py')
-rw-r--r--lib/sqlalchemy/engine/base.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index dc42ed957..f040ec920 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -794,6 +794,14 @@ class Connection(Connectable):
"""
return self.engine.Connection(self.engine, self.__connection, _branch=True)
+
+ def _clone(self):
+ """Create a shallow copy of this Connection.
+
+ """
+ c = self.__class__.__new__(self.__class__)
+ c.__dict__ = self.__dict__.copy()
+ return c
def execution_options(self, **opt):
""" Set non-SQL options for the connection which take effect during execution.
@@ -811,9 +819,9 @@ class Connection(Connectable):
:meth:`sqlalchemy.sql.expression.Executable.execution_options`.
"""
- return self.engine.Connection(
- self.engine, self.__connection,
- _branch=self.__branch, _execution_options=opt)
+ c = self._clone()
+ c._execution_options = c._execution_options.union(opt)
+ return c
@property
def dialect(self):