summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/base.py
diff options
context:
space:
mode:
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):