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

Function _populate_partial

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

Source from the content-addressed store, hash-verified

1384
1385
1386def _populate_partial(
1387 context, row, state, dict_, isnew, load_path, unloaded, populators
1388):
1389 if not isnew:
1390 if unloaded:
1391 # extra pass, see #8166
1392 for key, getter in populators["quick"]:
1393 if key in unloaded:
1394 dict_[key] = getter(row)
1395
1396 to_load = context.partials[state]
1397 for key, populator in populators["existing"]:
1398 if key in to_load:
1399 populator(state, dict_, row)
1400 else:
1401 to_load = unloaded
1402 context.partials[state] = to_load
1403
1404 for key, getter in populators["quick"]:
1405 if key in to_load:
1406 dict_[key] = getter(row)
1407 for key, set_callable in populators["expire"]:
1408 if key in to_load:
1409 dict_.pop(key, None)
1410 if set_callable:
1411 state.expired_attributes.add(key)
1412 for key, populator in populators["new"]:
1413 if key in to_load:
1414 populator(state, dict_, row)
1415
1416 for key, populator in populators["eager"]:
1417 if key not in unloaded:
1418 populator(state, dict_, row)
1419
1420 return to_load
1421
1422
1423def _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