summaryrefslogtreecommitdiff
path: root/doc/build/changelog/unreleased_20/8372.rst
diff options
context:
space:
mode:
Diffstat (limited to 'doc/build/changelog/unreleased_20/8372.rst')
-rw-r--r--doc/build/changelog/unreleased_20/8372.rst23
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/build/changelog/unreleased_20/8372.rst b/doc/build/changelog/unreleased_20/8372.rst
new file mode 100644
index 000000000..97927198b
--- /dev/null
+++ b/doc/build/changelog/unreleased_20/8372.rst
@@ -0,0 +1,23 @@
+.. change::
+ :tags: bug, orm
+ :tickets: 8372
+
+ Changed the attribute access method used by
+ :func:`_orm.attribute_mapped_collection` and
+ :func:`_orm.column_mapped_collection`, used when populating the dictionary,
+ to assert that the data value on the object to be used as the dictionary
+ key is actually present, and is not instead using "None" due to the
+ attribute never being actually assigned. This is used to prevent a
+ mis-population of None for a key when assigning via a backref where the
+ "key" attribute on the object is not yet assigned.
+
+ As the failure mode here is a transitory condition that is not typically
+ persisted to the database, and is easy to produce via the constructor of
+ the class based on the order in which parameters are assigned, it is very
+ possible that many applications include this behavior already which is
+ silently passed over. To accommodate for applications where this error is
+ now raised, a new parameter
+ :paramref:`_orm.attribute_mapped_collection.ignore_unpopulated_attribute`
+ is also added to both :func:`_orm.attribute_mapped_collection` and
+ :func:`_orm.column_mapped_collection` that instead causes the erroneous
+ backref assignment to be skipped.