From 6b60d3a9e6ba93d177ac777bfaae8269c18ddee6 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 25 Jul 2014 12:14:22 -0400 Subject: - The MySQL dialect will now disable :meth:`.ConnectionEvents.handle_error` events from firing for those statements which it uses internally to detect if a table exists or not. This is achieved using an execution option ``skip_user_error_events`` that disables the handle error event for the scope of that execution. In this way, user code that rewrites exceptions doesn't need to worry about the MySQL dialect or other dialects that occasionally need to catch SQLAlchemy specific exceptions. --- lib/sqlalchemy/engine/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/engine/base.py') diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index cf0689626..f9dfea32b 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -1112,7 +1112,9 @@ class Connection(Connectable): newraise = None - if self._has_events or self.engine._has_events: + if (self._has_events or self.engine._has_events) and \ + not self._execution_options.get( + 'skip_user_error_events', False): # legacy dbapi_error event if should_wrap and context: self.dispatch.dbapi_error(self, -- cgit v1.2.1