diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2018-02-07 20:58:47 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit@ci.zzzcomputing.com> | 2018-02-07 20:58:47 -0500 |
commit | ba957f84d333918ca34d562b407cc6d65bccbccb (patch) | |
tree | 4ec38c96ba774bdc6b8ef91ed55ae81c954b21fe /lib/sqlalchemy/engine/base.py | |
parent | 9f657fee5ba66820b9cd6b80653332c07eec0451 (diff) | |
parent | 4065352c7e9779cfeae34f01073ef6c43aeae488 (diff) | |
download | sqlalchemy-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.py | 16 |
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) |