diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-05-22 14:08:55 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-05-22 15:51:07 -0400 |
commit | 9f0fb6c601829cb7c9f449d57e12e8b95dab51f5 (patch) | |
tree | 1201e89aa89fac39316ccfa87567a88b9667fa4c /lib/sqlalchemy/exc.py | |
parent | da1bc9878b71f6f7b87e2fa7895e1631ae581609 (diff) | |
download | sqlalchemy-9f0fb6c601829cb7c9f449d57e12e8b95dab51f5.tar.gz |
Allow metadata.reflect() to recover from unreflectable tables
Added support for views that are unreflectable due to stale
table definitions, when calling :meth:`.MetaData.reflect`; a warning
is emitted for the table that cannot respond to ``DESCRIBE``
but the operation succeeds. The MySQL dialect now
raises UnreflectableTableError which is in turn caught by
MetaData.reflect(). Reflecting the view standalone raises
this error directly.
Change-Id: Id8005219d8e073c154cc84a873df911b4a6cf4d6
Fixes: #3871
Diffstat (limited to 'lib/sqlalchemy/exc.py')
-rw-r--r-- | lib/sqlalchemy/exc.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/sqlalchemy/exc.py b/lib/sqlalchemy/exc.py index e8ba34ba4..3db3c1085 100644 --- a/lib/sqlalchemy/exc.py +++ b/lib/sqlalchemy/exc.py @@ -199,6 +199,14 @@ class NoSuchTableError(InvalidRequestError): """Table does not exist or is not visible to a connection.""" +class UnreflectableTableError(InvalidRequestError): + """Table exists but can't be reflectted for some reason. + + .. versionadded:: 1.2 + + """ + + class UnboundExecutionError(InvalidRequestError): """SQL was attempted without a database connection to execute it on.""" |