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]]
)
| 4677 | ) |
| 4678 | |
| 4679 | def bulk_update_mappings( |
| 4680 | self, mapper: _EntityBindKey[Any], mappings: Iterable[Dict[str, Any]] |
| 4681 | ) -> None: |
| 4682 | """Perform a bulk update of the given list of mapping dictionaries. |
| 4683 | |
| 4684 | .. legacy:: |
| 4685 | |
| 4686 | This method is a legacy feature as of the 2.0 series of |
| 4687 | SQLAlchemy. For modern bulk INSERT and UPDATE, see |
| 4688 | the sections :ref:`orm_queryguide_bulk_insert` and |
| 4689 | :ref:`orm_queryguide_bulk_update`. The 2.0 API shares |
| 4690 | implementation details with this method and adds new features |
| 4691 | as well. |
| 4692 | |
| 4693 | :param mapper: a mapped class, or the actual :class:`_orm.Mapper` |
| 4694 | object, |
| 4695 | representing the single kind of object represented within the mapping |
| 4696 | list. |
| 4697 | |
| 4698 | :param mappings: a sequence of dictionaries, each one containing the |
| 4699 | state of the mapped row to be updated, in terms of the attribute names |
| 4700 | on the mapped class. If the mapping refers to multiple tables, such |
| 4701 | as a joined-inheritance mapping, each dictionary may contain keys |
| 4702 | corresponding to all tables. All those keys which are present and |
| 4703 | are not part of the primary key are applied to the SET clause of the |
| 4704 | UPDATE statement; the primary key values, which are required, are |
| 4705 | applied to the WHERE clause. |
| 4706 | |
| 4707 | |
| 4708 | .. seealso:: |
| 4709 | |
| 4710 | :doc:`queryguide/dml` |
| 4711 | |
| 4712 | :meth:`.Session.bulk_insert_mappings` |
| 4713 | |
| 4714 | :meth:`.Session.bulk_save_objects` |
| 4715 | |
| 4716 | """ |
| 4717 | self._bulk_save_mappings( |
| 4718 | mapper, |
| 4719 | mappings, |
| 4720 | isupdate=True, |
| 4721 | isstates=False, |
| 4722 | return_defaults=False, |
| 4723 | update_changed_only=False, |
| 4724 | render_nulls=False, |
| 4725 | ) |
| 4726 | |
| 4727 | def _bulk_save_mappings( |
| 4728 | self, |