]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
add option to create scalar object on none attribute set
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 24 Jun 2023 01:57:41 +0000 (21:57 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 24 Jun 2023 01:57:41 +0000 (21:57 -0400)
commitbf5cb5268c0d12f44c1537abfef1a1244b2982bb
tree87e1e7da08f97f0133dba4f446c82c2fe50455c7
parent1e7dcdd6bda3fa49848f5d7f0b82b3145c541b5b
add option to create scalar object on none attribute set

Added new option to :func:`.association_proxy`
:paramref:`.association_proxy.create_on_none_assignment`; when an
association proxy which refers to a scalar relationship is assigned the
value ``None``, and the referenced object is not present, a new object is
created via the creator.  This was apparently an undefined behavior in the
1.2 series that was silently removed.

Fixes: #10013
Change-Id: I3aae484b8cf5218588b1db63e691cd86214fbbad
doc/build/changelog/unreleased_20/10013.rst [new file with mode: 0644]
lib/sqlalchemy/ext/associationproxy.py
test/ext/test_associationproxy.py