From: Federico Caselli Date: Thu, 1 Apr 2021 17:47:20 +0000 (+0200) Subject: Fix has table reflection on MySQL 5.0 5.1 X-Git-Tag: rel_1_4_5~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be200636a90e0ab5cd54f694c03b6593013665e1;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git 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 --- 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(