]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fix has table reflection on MySQL 5.0 5.1
authorFederico Caselli <cfederico87@gmail.com>
Thu, 1 Apr 2021 17:47:20 +0000 (19:47 +0200)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 1 Apr 2021 18:36:13 +0000 (14:36 -0400)
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 [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/base.py

diff --git a/doc/build/changelog/unreleased_14/6151.rst b/doc/build/changelog/unreleased_14/6151.rst
new file mode 100644 (file)
index 0000000..318cdbf
--- /dev/null
@@ -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.
index e6052f69f7e81be06d7cac8883aa57fa51cebdea..b3c338bad60a9aa40cee7478bcf11742bd83b7e3 100644 (file)
@@ -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(