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])
| 3489 | self._save_or_update_state(state) |
| 3490 | |
| 3491 | def add_all(self, instances: Iterable[object]) -> None: |
| 3492 | """Add the given collection of instances to this :class:`_orm.Session`. |
| 3493 | |
| 3494 | See the documentation for :meth:`_orm.Session.add` for a general |
| 3495 | behavioral description. |
| 3496 | |
| 3497 | .. seealso:: |
| 3498 | |
| 3499 | :meth:`_orm.Session.add` |
| 3500 | |
| 3501 | :ref:`session_adding` - at :ref:`session_basics` |
| 3502 | |
| 3503 | """ |
| 3504 | |
| 3505 | if self._warn_on_events: |
| 3506 | self._flush_warning("Session.add_all()") |
| 3507 | |
| 3508 | for instance in instances: |
| 3509 | self.add(instance, _warn=False) |
| 3510 | |
| 3511 | def _save_or_update_state(self, state: InstanceState[Any]) -> None: |
| 3512 | state._orphaned_outside_of_session = False |