]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
consult allow_partial_pks for NULL check in lazyload
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 13 Oct 2024 14:04:23 +0000 (10:04 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 13 Oct 2024 14:21:42 +0000 (10:21 -0400)
commit24323f744aa8e2ccc635e58b5f58e11d9b531f93
tree3568904ba99419328e97ff3f6cf14e5a8ffd46ea
parent0dda26af500941b9ec916e1be5b6091f7072578f
consult allow_partial_pks for NULL check in lazyload

Refined the check which the ORM lazy loader uses to detect "this would be
loading by primary key and the primary key is NULL, skip loading" to take
into account the current setting for the
:paramref:`.orm.Mapper.allow_partial_pks` parameter. If this parameter is
False, then a composite PK value that has partial NULL elements should also
be skipped.   This can apply to some composite overlapping foreign key
configurations.

Fixes: #11995
Change-Id: Icf9a52b7405d7400d46bfa944edcbff1a89225a3
(cherry picked from commit 830debc30896203bfd21fea18d323c5d849068d1)
doc/build/changelog/unreleased_20/11995.rst [new file with mode: 0644]
lib/sqlalchemy/orm/base.py
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/strategies.py
lib/sqlalchemy/orm/util.py
test/orm/test_lazy_relations.py