MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / merge_all

Method merge_all

lib/sqlalchemy/orm/session.py:4098–4132  ·  view source on GitHub ↗

Calls :meth:`.Session.merge` on multiple instances. .. seealso:: :meth:`.Session.merge` - main documentation on merge .. versionadded:: 2.1

(
        self,
        instances: Iterable[_O],
        *,
        load: bool = True,
        options: Optional[Sequence[ORMOption]] = None,
    )

Source from the content-addressed store, hash-verified

4096 )
4097
4098 def merge_all(
4099 self,
4100 instances: Iterable[_O],
4101 *,
4102 load: bool = True,
4103 options: Optional[Sequence[ORMOption]] = None,
4104 ) -> Sequence[_O]:
4105 """Calls :meth:`.Session.merge` on multiple instances.
4106
4107 .. seealso::
4108
4109 :meth:`.Session.merge` - main documentation on merge
4110
4111 .. versionadded:: 2.1
4112
4113 """
4114
4115 if self._warn_on_events:
4116 self._flush_warning("Session.merge_all()")
4117
4118 if load:
4119 # flush current contents if we expect to load data
4120 self._autoflush()
4121
4122 return [
4123 self._merge(
4124 object_state(instance),
4125 attributes.instance_dict(instance),
4126 load=load,
4127 options=options,
4128 _recursive={},
4129 _resolve_conflict_map={},
4130 )
4131 for instance in instances
4132 ]
4133
4134 def _merge(
4135 self,

Callers 1

test_merge_allMethod · 0.45

Calls 4

_flush_warningMethod · 0.95
_autoflushMethod · 0.95
_mergeMethod · 0.95
object_stateFunction · 0.85

Tested by 1

test_merge_allMethod · 0.36