]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
manufacture empty result for DELETE..RETURNING w/ no description
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 19 Oct 2023 16:14:14 +0000 (12:14 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 19 Oct 2023 16:26:13 +0000 (12:26 -0400)
commitc6270f4cfb0616b7b8676aac9092b8d959f96df7
tree79a70666692d69e411735790519ab9ecfb873d76
parentefe4025c068d6746637db362245ab88ce7dfe785
manufacture empty result for DELETE..RETURNING w/ no description

Established a workaround for what seems to be an intrinsic issue across
MySQL/MariaDB drivers where a RETURNING result for DELETE DML which returns
no rows using SQLAlchemy's "empty IN" criteria fails to provide a
cursor.description, which then yields result that returns no rows,
leading to regressions for the ORM that in the 2.0 series uses RETURNING
for bulk DELETE statements for the "synchronize session" feature. To
resolve, when the specific case of "no description when RETURNING was
given" is detected, an "empty result" with a correct cursor description is
generated and used in place of the non-working cursor.

Fixes: #10505
Change-Id: Ib56f1ec5746e2b3212e563169353bc023db84099
doc/build/changelog/unreleased_20/10505.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/base.py
lib/sqlalchemy/dialects/mysql/mariadbconnector.py
lib/sqlalchemy/testing/suite/test_update_delete.py