Perform a bulk update of the given list of mapping dictionaries. .. legacy:: This method is a legacy feature as of the 2.0 series of SQLAlchemy. For modern bulk INSERT and UPDATE, see the sections :ref:`orm_queryguide_bulk_insert` and :ref:
(
self, mapper: _EntityBindKey[Any], mappings: Iterable[Dict[str, Any]]
)
| 4843 | ) |
| 4844 | |
| 4845 | def bulk_update_mappings( |
| 4846 | self, mapper: _EntityBindKey[Any], mappings: Iterable[Dict[str, Any]] |
| 4847 | ) -> None: |
| 4848 | """Perform a bulk update of the given list of mapping dictionaries. |
| 4849 | |
| 4850 | .. legacy:: |
| 4851 | |
| 4852 | This method is a legacy feature as of the 2.0 series of |
| 4853 | SQLAlchemy. For modern bulk INSERT and UPDATE, see |
| 4854 | the sections :ref:`orm_queryguide_bulk_insert` and |
| 4855 | :ref:`orm_queryguide_bulk_update`. The 2.0 API shares |
| 4856 | implementation details with this method and adds new features |
| 4857 | as well. |
| 4858 | |
| 4859 | :param mapper: a mapped class, or the actual :class:`_orm.Mapper` |
| 4860 | object, |
| 4861 | representing the single kind of object represented within the mapping |
| 4862 | list. |
| 4863 | |
| 4864 | :param mappings: a sequence of dictionaries, each one containing the |
| 4865 | state of the mapped row to be updated, in terms of the attribute names |
| 4866 | on the mapped class. If the mapping refers to multiple tables, such |
| 4867 | as a joined-inheritance mapping, each dictionary may contain keys |
| 4868 | corresponding to all tables. All those keys which are present and |
| 4869 | are not part of the primary key are applied to the SET clause of the |
| 4870 | UPDATE statement; the primary key values, which are required, are |
| 4871 | applied to the WHERE clause. |
| 4872 | |
| 4873 | |
| 4874 | .. seealso:: |
| 4875 | |
| 4876 | :doc:`queryguide/dml` |
| 4877 | |
| 4878 | :meth:`.Session.bulk_insert_mappings` |
| 4879 | |
| 4880 | :meth:`.Session.bulk_save_objects` |
| 4881 | |
| 4882 | """ |
| 4883 | self._bulk_save_mappings( |
| 4884 | mapper, |
| 4885 | mappings, |
| 4886 | isupdate=True, |
| 4887 | isstates=False, |
| 4888 | return_defaults=False, |
| 4889 | update_changed_only=False, |
| 4890 | render_nulls=False, |
| 4891 | ) |
| 4892 | |
| 4893 | def _bulk_save_mappings( |
| 4894 | self, |