]> 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:46 +0000 (08:12 -0400)
commitbd1c17f11318d0b581f59c8c6521979246abc9b8
tree43d93f2c5a9040e7a8d6354480a7bad59a0fc9ef
parentfe03298593e59e5d40de81e7f864690e73930666
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
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