summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-11-01 13:15:14 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2018-11-02 01:22:41 -0400
commit2e2af8d918a568ca3036f88e457caaf59f6af644 (patch)
treee9f2c307a79fe1a0111f702e10166aa6ba5021f3 /doc
parent7d372da7385be6a9817a20b6b62f7c4237af7b26 (diff)
downloadsqlalchemy-2e2af8d918a568ca3036f88e457caaf59f6af644.tar.gz
Implement __delete__
A long-standing oversight in the ORM, the ``__delete__`` method for a many- to-one relationship was non-functional, e.g. for an operation such as ``del a.b``. This is now implemented and is equivalent to setting the attribute to ``None``. Fixes: #4354 Change-Id: I60131a84c007b0bf6f20c5cc5f21a3b96e954046
Diffstat (limited to 'doc')
-rw-r--r--doc/build/changelog/migration_13.rst18
-rw-r--r--doc/build/changelog/unreleased_13/4354.rst12
2 files changed, 30 insertions, 0 deletions
diff --git a/doc/build/changelog/migration_13.rst b/doc/build/changelog/migration_13.rst
index 585a9c3a5..fee5ad5e9 100644
--- a/doc/build/changelog/migration_13.rst
+++ b/doc/build/changelog/migration_13.rst
@@ -84,6 +84,24 @@ users should report a bug, however the change also incldues a flag
:ticket:`4340`
+.. _change_4354:
+
+"del" implemented for ORM attributes
+------------------------------------
+
+The Python ``del`` operation was not really usable for mapped attributes, either
+scalar columns or object references. Support has been added for this to work correctly,
+where the ``del`` operation is roughly equivalent to setting the attribute to the
+``None`` value::
+
+
+ some_object = session.query(SomeObject).get(5)
+
+ del some_object.some_attribute # from a SQL perspective, works like "= None"
+
+:ticket:`4354`
+
+
.. _change_4257:
info dictionary added to InstanceState
diff --git a/doc/build/changelog/unreleased_13/4354.rst b/doc/build/changelog/unreleased_13/4354.rst
new file mode 100644
index 000000000..ba25a2231
--- /dev/null
+++ b/doc/build/changelog/unreleased_13/4354.rst
@@ -0,0 +1,12 @@
+.. change::
+ :tags: bug, orm
+ :tickets: 4354
+
+ A long-standing oversight in the ORM, the ``__delete__`` method for a many-
+ to-one relationship was non-functional, e.g. for an operation such as ``del
+ a.b``. This is now implemented and is equivalent to setting the attribute
+ to ``None``.
+
+ .. seealso::
+
+ :ref:`change_4354` \ No newline at end of file