diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-07-25 12:14:22 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-07-25 12:14:22 -0400 |
| commit | 6b60d3a9e6ba93d177ac777bfaae8269c18ddee6 (patch) | |
| tree | d663ca41f3bf05fcfbae2755426469cae5f855f1 /lib/sqlalchemy/dialects/mysql/base.py | |
| parent | 8560522ff0244c93dab62276f9ba445df90f0d39 (diff) | |
| download | sqlalchemy-6b60d3a9e6ba93d177ac777bfaae8269c18ddee6.tar.gz | |
- 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.
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/base.py')
| -rw-r--r-- | lib/sqlalchemy/dialects/mysql/base.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index 0c00cf530..06c3b0c50 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -2310,7 +2310,8 @@ class MySQLDialect(default.DefaultDialect): rs = None try: try: - rs = connection.execute(st) + rs = connection.execution_options( + skip_user_error_events=True).execute(st) have = rs.fetchone() is not None rs.close() return have @@ -2616,7 +2617,8 @@ class MySQLDialect(default.DefaultDialect): rp = None try: - rp = connection.execute(st) + rp = connection.execution_options( + skip_user_error_events=True).execute(st) except exc.DBAPIError as e: if self._extract_error_code(e.orig) == 1146: raise exc.NoSuchTableError(full_name) @@ -2640,7 +2642,8 @@ class MySQLDialect(default.DefaultDialect): rp, rows = None, None try: try: - rp = connection.execute(st) + rp = connection.execution_options( + skip_user_error_events=True).execute(st) except exc.DBAPIError as e: if self._extract_error_code(e.orig) == 1146: raise exc.NoSuchTableError(full_name) |
