From be200636a90e0ab5cd54f694c03b6593013665e1 Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Thu, 1 Apr 2021 19:47:20 +0200 Subject: [PATCH] Fix has table reflection on MySQL 5.0 5.1 Fixed regression in the MySQL dialect where the reflection query used to detect if a table exists would fail on very old MySQL 5.0 and 5.1 versions. Fixes: #6151 Change-Id: I48e98542c3a1a49519a5d113e43ba6f917e8580e --- doc/build/changelog/unreleased_14/6151.rst | 6 ++++++ lib/sqlalchemy/dialects/mysql/base.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 doc/build/changelog/unreleased_14/6151.rst diff --git a/doc/build/changelog/unreleased_14/6151.rst b/doc/build/changelog/unreleased_14/6151.rst new file mode 100644 index 0000000000..318cdbf62e --- /dev/null +++ b/doc/build/changelog/unreleased_14/6151.rst @@ -0,0 +1,6 @@ +.. change:: + :tags: bug, mysql, regression + :tickets: 6163 + + Fixed regression in the MySQL dialect where the reflection query used to + detect if a table exists would fail on very old MySQL 5.0 and 5.1 versions. diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index e6052f69f7..b3c338bad6 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -2812,7 +2812,7 @@ class MySQLDialect(default.DefaultDialect): rs = connection.execute( text( - "SELECT * FROM information_schema.tables WHERE " + "SELECT COUNT(*) FROM information_schema.tables WHERE " "table_schema = :table_schema AND " "table_name = :table_name" ).bindparams( -- 2.47.2