.. warning:: Note that the ORM's "delete" and "delete-cascade" behavior applies
**only** to the use of the :meth:`_orm.Session.delete` method to mark
- individual ORM instances for deletion within the :term:`unit-of-work` process.
+ individual ORM instances for deletion within the :term:`unit of work` process.
It does **not** apply to "bulk" deletes, which would be emitted using
the :func:`_sql.delete` construct as illustrated at
:ref:`orm_queryguide_update_delete_where`. See
is passed to the constructor for :class:`_orm.Mapper`. An alternative to this
approach is in the next example.
+
+.. warning::
+ Declaring a dataclass ``field()`` setting a ``default`` together with ``init=False``
+ will not work as would be expected with a totally plain dataclass,
+ since the SQLAlchemy class instrumentation will replace
+ the default value set on the class by the dataclass creation process.
+ Use ``default_factory`` instead. This adaptation is done automatically when
+ making use of :ref:`orm_declarative_native_dataclasses`.
+
.. _orm_declarative_dataclasses_declarative_table:
Mapping pre-existing dataclasses using Declarative-style fields
mapper_registry.map_imperatively(Address, address)
+The same warning mentioned in :ref:`orm_declarative_dataclasses_imperative_table`
+applies when using this mapping style.
+
.. _orm_declarative_attrs_imperative_table:
Applying ORM mappings to an existing attrs class
.. warning:: Please read the following section :ref:`orm_queryguide_update_delete_caveats`
for important notes regarding how the functionality of ORM-Enabled UPDATE and DELETE
- diverges from that of ORM :term:`unit-of-work` features, such
+ diverges from that of ORM :term:`unit of work` features, such
as using the :meth:`_orm.Session.delete` method to delete individual objects.
Important Notes and Caveats for ORM-Enabled Update and Delete
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The ORM-enabled UPDATE and DELETE features bypass ORM :term:`unit-of-work`
+The ORM-enabled UPDATE and DELETE features bypass ORM :term:`unit of work`
automation in favor of being able to emit a single UPDATE or DELETE statement
that matches multiple rows at once without complexity.