MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _synchronize

Method _synchronize

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

Source from the content-addressed store, hash-verified

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