]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
honor prefetch_cols and postfetch_cols in ORM update w/ WHERE criteria
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 25 Sep 2024 18:19:02 +0000 (14:19 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 9 Oct 2024 12:12:53 +0000 (08:12 -0400)
commitcbd43c847d534cd610a704a86037aa88ed3c71ce
tree3d41a0fd0db8bcedf3800c43daf4ae4c2cf876e9
parent9ad928b61b17dcec459e051814b0618288604da0
honor prefetch_cols and postfetch_cols in ORM update w/ WHERE criteria

Continuing from :ticket:`11912`, columns marked with
:paramref:`.mapped_column.onupdate`,
:paramref:`.mapped_column.server_onupdate`, or :class:`.Computed` are now
refreshed in ORM instances when running an ORM enabled UPDATE with WHERE
criteria, even if the statement does not use RETURNING or
populate_existing.

this moves the test we added in #11912 to be in
test_update_delete_where, since this behavior is not related to bulk
statements.    For bulk statements, we're building onto the "many rows
fast" use case and we as yet intentionally don't do any "bookkeeping",
which means none of the expiration or any of that. would need to rethink
"bulk update" a bit to get onupdates to refresh.

Fixes: #11917
Change-Id: I9601be7afed523b356ce47a6daf98cc6584f4ad3
(cherry picked from commit bd1c17f11318d0b581f59c8c6521979246abc9b8)
doc/build/changelog/unreleased_20/11917.rst [new file with mode: 0644]
lib/sqlalchemy/orm/bulk_persistence.py
test/orm/dml/test_bulk_statements.py
test/orm/dml/test_update_delete_where.py