diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-02-06 13:54:56 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-02-06 16:06:11 -0500 |
| commit | 662d6e24526bfd9d358b8a9e1906fb29bf93ef30 (patch) | |
| tree | cd473a0b48312f599ec7a7d65ef43cd617420a41 /lib/sqlalchemy/testing | |
| parent | ce7922dfd001a0e9fc0914ec217c950acc5e0e5f (diff) | |
| download | sqlalchemy-662d6e24526bfd9d358b8a9e1906fb29bf93ef30.tar.gz | |
add error code 1049 for mysql has_table
Fixed regression caused by issue :ticket:`9058` which adjusted the MySQL
dialect's ``has_table()`` to again use "DESCRIBE", where the specific error
code raised by MySQL version 8 when using a non-existent schema name was
unexpected and failed to be interpreted as a boolean result.
Fixed the SQLite dialect's ``has_table()`` function to correctly report
False for queries that include a non-None schema name for a schema that
doesn't exist; previously, a database error was raised.
Fixes: #9251
Change-Id: I5ef9cf0887865c3c521d88bca0ba18954a108241
Diffstat (limited to 'lib/sqlalchemy/testing')
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_reflection.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_reflection.py b/lib/sqlalchemy/testing/suite/test_reflection.py index 2550eff4e..8b7cb8cbc 100644 --- a/lib/sqlalchemy/testing/suite/test_reflection.py +++ b/lib/sqlalchemy/testing/suite/test_reflection.py @@ -177,6 +177,15 @@ class HasTableTest(OneConnectionTablesTest): ) ) + @testing.requires.schemas + def test_has_table_nonexistent_schema(self): + with config.db.begin() as conn: + is_false( + config.db.dialect.has_table( + conn, "test_table", schema="nonexistent_schema" + ) + ) + @testing.requires.views def test_has_table_view(self, connection): insp = inspect(connection) |
