MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / add

Method add

lib/sqlalchemy/ext/asyncio/session.py:1157–1189  ·  view source on GitHub ↗

r"""Place an object into this :class:`_orm.Session`. .. container:: class_bases Proxied for the :class:`_orm.Session` class on behalf of the :class:`_asyncio.AsyncSession` class. Objects that are in the :term:`transient` state when passed to the :me

(self, instance: object, *, _warn: bool = True)

Source from the content-addressed store, hash-verified

1155 return self._proxied.__iter__()
1156
1157 def add(self, instance: object, *, _warn: bool = True) -> None:
1158 r"""Place an object into this :class:`_orm.Session`.
1159
1160 .. container:: class_bases
1161
1162 Proxied for the :class:`_orm.Session` class on
1163 behalf of the :class:`_asyncio.AsyncSession` class.
1164
1165 Objects that are in the :term:`transient` state when passed to the
1166 :meth:`_orm.Session.add` method will move to the
1167 :term:`pending` state, until the next flush, at which point they
1168 will move to the :term:`persistent` state.
1169
1170 Objects that are in the :term:`detached` state when passed to the
1171 :meth:`_orm.Session.add` method will move to the :term:`persistent`
1172 state directly.
1173
1174 If the transaction used by the :class:`_orm.Session` is rolled back,
1175 objects which were transient when they were passed to
1176 :meth:`_orm.Session.add` will be moved back to the
1177 :term:`transient` state, and will no longer be present within this
1178 :class:`_orm.Session`.
1179
1180 .. seealso::
1181
1182 :meth:`_orm.Session.add_all`
1183
1184 :ref:`session_adding` - at :ref:`session_basics`
1185
1186
1187 """ # noqa: E501
1188
1189 return self._proxied.add(instance, _warn=_warn)
1190
1191 def add_all(self, instances: Iterable[object]) -> None:
1192 r"""Add the given collection of instances to this :class:`_orm.Session`.

Calls

no outgoing calls