Add the given collection of instances to this :class:`_orm.Session`. See the documentation for :meth:`_orm.Session.add` for a general behavioral description. .. seealso:: :meth:`_orm.Session.add` :ref:`session_adding` - at :ref:`session_basics`
(self, instances: Iterable[object])
| 3591 | self._save_or_update_state(state) |
| 3592 | |
| 3593 | def add_all(self, instances: Iterable[object]) -> None: |
| 3594 | """Add the given collection of instances to this :class:`_orm.Session`. |
| 3595 | |
| 3596 | See the documentation for :meth:`_orm.Session.add` for a general |
| 3597 | behavioral description. |
| 3598 | |
| 3599 | .. seealso:: |
| 3600 | |
| 3601 | :meth:`_orm.Session.add` |
| 3602 | |
| 3603 | :ref:`session_adding` - at :ref:`session_basics` |
| 3604 | |
| 3605 | """ |
| 3606 | |
| 3607 | if self._warn_on_events: |
| 3608 | self._flush_warning("Session.add_all()") |
| 3609 | |
| 3610 | for instance in instances: |
| 3611 | self.add(instance, _warn=False) |
| 3612 | |
| 3613 | def _save_or_update_state(self, state: InstanceState[Any]) -> None: |
| 3614 | state._orphaned_outside_of_session = False |