]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Run autoflush for column attribute load operations
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 3 Apr 2020 00:45:44 +0000 (20:45 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 3 Apr 2020 17:47:57 +0000 (13:47 -0400)
commitc7d3ca0da477451885158a923aa9ee7e49794541
tree9f5255bbec244ef8abce42bd8694aae9631e70a7
parent49b6c50016c8a038a6df7104560bb3945debe064
Run autoflush for column attribute load operations

The "autoflush" behavior of :class:`.Query` will now trigger for nearly
all ORM level attribute load operations, including when a deferred
column is loaded as well as when an expired column is loaded.   Previously,
autoflush on load of expired or unloaded attributes was limited to
relationship-bound attributes only.   However, this led to the issue
where column-based attributes that also depended on other rows, or even
other columns in the same row, in order to express the correct value,
would show an effectively stale value when accessed as there could be
pending changes in the session left to be flushed.    Autoflush
is now disabled only in some cases where attributes are being unexpired in
the context of a history operation.

Fixes: #5226
Change-Id: Ibd965b30918cd273ae020411a704bf2bb1891f59
13 files changed:
doc/build/changelog/unreleased_14/5226.rst [new file with mode: 0644]
lib/sqlalchemy/orm/loading.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/orm/session.py
lib/sqlalchemy/orm/state.py
test/ext/test_extendedattr.py
test/orm/test_attributes.py
test/orm/test_cascade.py
test/orm/test_deferred.py
test/orm/test_dynamic.py
test/orm/test_expire.py
test/orm/test_load_on_fks.py
test/orm/test_versioning.py