MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _synchronize

Method _synchronize

lib/sqlalchemy/orm/dependency.py:1264–1294  ·  view source on GitHub ↗
(
        self, state, child, associationrow, clearkeys, uowcommit, operation
    )

Source from the content-addressed store, hash-verified

1262 connection.execute(statement, secondary_insert)
1263
1264 def _synchronize(
1265 self, state, child, associationrow, clearkeys, uowcommit, operation
1266 ):
1267 # this checks for None if uselist=True
1268 self._verify_canload(child)
1269
1270 # but if uselist=False we get here. If child is None,
1271 # no association row can be generated, so return.
1272 if child is None:
1273 return False
1274
1275 if child is not None and not uowcommit.session._contains_state(child):
1276 if not child.deleted:
1277 util.warn(
1278 "Object of type %s not in session, %s "
1279 "operation along '%s' won't proceed"
1280 % (mapperutil.state_class_str(child), operation, self.prop)
1281 )
1282 return False
1283
1284 sync._populate_dict(
1285 state, self.parent, associationrow, self.prop.synchronize_pairs
1286 )
1287 sync._populate_dict(
1288 child,
1289 self.mapper,
1290 associationrow,
1291 self.prop.secondary_synchronize_pairs,
1292 )
1293
1294 return True
1295
1296 def _pks_changed(self, uowcommit, state):
1297 return sync._source_modified(

Callers 2

process_deletesMethod · 0.95
process_savesMethod · 0.95

Calls 3

_verify_canloadMethod · 0.80
_contains_stateMethod · 0.80
warnMethod · 0.45

Tested by

no test coverage detected