summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/base.py
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2018-02-07 20:58:47 -0500
committerGerrit Code Review <gerrit@ci.zzzcomputing.com>2018-02-07 20:58:47 -0500
commitba957f84d333918ca34d562b407cc6d65bccbccb (patch)
tree4ec38c96ba774bdc6b8ef91ed55ae81c954b21fe /lib/sqlalchemy/engine/base.py
parent9f657fee5ba66820b9cd6b80653332c07eec0451 (diff)
parent4065352c7e9779cfeae34f01073ef6c43aeae488 (diff)
downloadsqlalchemy-ba957f84d333918ca34d562b407cc6d65bccbccb.tar.gz
Merge "Add flag for class-level disallow of events, apply to OptionEngine"
Diffstat (limited to 'lib/sqlalchemy/engine/base.py')
-rw-r--r--lib/sqlalchemy/engine/base.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index 4bae94317..aa9358cd6 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -2189,6 +2189,8 @@ class Engine(Connectable, log.Identified):
class OptionEngine(Engine):
+ _sa_propagate_class_events = False
+
def __init__(self, proxied, execution_options):
self._proxied = proxied
self.url = proxied.url
@@ -2196,7 +2198,21 @@ class OptionEngine(Engine):
self.logging_name = proxied.logging_name
self.echo = proxied.echo
log.instance_logger(self, echoflag=self.echo)
+
+ # note: this will propagate events that are assigned to the parent
+ # engine after this OptionEngine is created. Since we share
+ # the events of the parent we also disallow class-level events
+ # to apply to the OptionEngine class directly.
+ #
+ # the other way this can work would be to transfer existing
+ # events only, using:
+ # self.dispatch._update(proxied.dispatch)
+ #
+ # that might be more appropriate however it would be a behavioral
+ # change for logic that assigns events to the parent engine and
+ # would like it to take effect for the already-created sub-engine.
self.dispatch = self.dispatch._join(proxied.dispatch)
+
self._execution_options = proxied._execution_options
self.update_execution_options(**execution_options)