]> 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:36 +0000 (10:21 -0400)
commit830debc30896203bfd21fea18d323c5d849068d1
tree6d004564e30f081664c4fd962ab0507cc87822be
parenta98d31621d58d45e2a4d74351282cedddcfe85fa
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
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