MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _populate_partial

Function _populate_partial

lib/sqlalchemy/orm/loading.py:1393–1427  ·  view source on GitHub ↗
(
    context, row, state, dict_, isnew, load_path, unloaded, populators
)

Source from the content-addressed store, hash-verified

1391
1392
1393def _populate_partial(
1394 context, row, state, dict_, isnew, load_path, unloaded, populators
1395):
1396 if not isnew:
1397 if unloaded:
1398 # extra pass, see #8166
1399 for key, getter in populators["quick"]:
1400 if key in unloaded:
1401 dict_[key] = getter(row)
1402
1403 to_load = context.partials[state]
1404 for key, populator in populators["existing"]:
1405 if key in to_load:
1406 populator(state, dict_, row)
1407 else:
1408 to_load = unloaded
1409 context.partials[state] = to_load
1410
1411 for key, getter in populators["quick"]:
1412 if key in to_load:
1413 dict_[key] = getter(row)
1414 for key, set_callable in populators["expire"]:
1415 if key in to_load:
1416 dict_.pop(key, None)
1417 if set_callable:
1418 state.expired_attributes.add(key)
1419 for key, populator in populators["new"]:
1420 if key in to_load:
1421 populator(state, dict_, row)
1422
1423 for key, populator in populators["eager"]:
1424 if key not in unloaded:
1425 populator(state, dict_, row)
1426
1427 return to_load
1428
1429
1430def _validate_version_id(mapper, state, dict_, row, getter):

Callers 1

_instanceFunction · 0.85

Calls 2

popMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected