summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-03-08 18:38:11 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-03-08 18:38:11 -0500
commite790b11460ffaf8cc68b309ad47fe0e314b2c67f (patch)
treec457fc4056ff0cf2280c4b811e251dfded20382a
parentc36965ab211183764357456fff1640418586ed97 (diff)
downloadsqlalchemy-e790b11460ffaf8cc68b309ad47fe0e314b2c67f.tar.gz
add note about slots=True for attrs
Fixes: #7802 Change-Id: Ic5fadd369a0b63309cd9c44798ee5395efdbab2b
-rw-r--r--doc/build/orm/declarative_styles.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/build/orm/declarative_styles.rst b/doc/build/orm/declarative_styles.rst
index 08c713a23..b171fc317 100644
--- a/doc/build/orm/declarative_styles.rst
+++ b/doc/build/orm/declarative_styles.rst
@@ -478,5 +478,12 @@ A mapping using ``@attr.s``, in conjunction with imperative table::
with the :meth:`_orm.registry.map_imperatively` function. See the section
:ref:`orm_imperative_dataclasses` for a similar example.
+.. note:: The ``attrs`` ``slots=True`` option, which enables ``__slots__`` on
+ a mapped class, cannot be used with SQLAlchemy mappings without fully
+ implementing alternative
+ :ref:`attribute instrumentation <examples_instrumentation>`, as mapped
+ classes normally rely upon direct access to ``__dict__`` for state storage.
+ Behavior is undefined when this option is present.
+
.. _dataclasses: https://docs.python.org/3/library/dataclasses.html
.. _attrs: https://pypi.org/project/attrs/