]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
revert MySQL to use DESCRIBE for has_table()
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 5 Jan 2023 04:32:23 +0000 (23:32 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 5 Jan 2023 14:38:04 +0000 (09:38 -0500)
commit7505cc5db44f2d3a84827519d3a7d926a9cdec23
treefb6a2478da983981036c779d698d72d1cd23d7f5
parent1e7d45283645c57556b7aecbc3a370a92de409ce
revert MySQL to use DESCRIBE for has_table()

Restored the behavior of :meth:`.Inspector.has_table` to report on
temporary tables for MySQL / MariaDB. This is currently the behavior for
all other included dialects, but was removed for MySQL in 1.4 due to no
longer using the DESCRIBE command; there was no documented support for temp
tables being reported by the :meth:`.Inspector.has_table` method in this
version or on any previous version, so the previous behavior was undefined.

As SQLAlchemy 2.0 has added formal support for temp table status via
:meth:`.Inspector.has_table`, the MySQL /MariaDB dialect has been reverted
to use the "DESCRIBE" statement as it did in the SQLAlchemy 1.3 series and
previously, and test support is added to include MySQL / MariaDB for
this behavior.   The previous issues with ROLLBACK being emitted which
1.4 sought to improve upon don't apply in SQLAlchemy 2.0 due to
simplifications in how :class:`.Connection` handles transactions.

DESCRIBE is necessary as MariaDB in particular has no consistently
available public information schema of any kind in order to report on temp
tables other than DESCRIBE/SHOW COLUMNS, which rely on throwing an error
in order to report no results.

Fixes: #9058
Change-Id: Ic511bd5989ec17beb37b7cddd913732b626af0e6
doc/build/changelog/unreleased_20/9058.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/base.py
lib/sqlalchemy/engine/interfaces.py
lib/sqlalchemy/engine/reflection.py
test/requirements.py