MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _expand_other_attrs

Function _expand_other_attrs

lib/sqlalchemy/orm/bulk_persistence.py:375–400  ·  view source on GitHub ↗
(
    mapper: Mapper[Any], mappings: Iterable[Dict[str, Any]]
)

Source from the content-addressed store, hash-verified

373
374
375def _expand_other_attrs(
376 mapper: Mapper[Any], mappings: Iterable[Dict[str, Any]]
377) -> None:
378 all_attrs = mapper.all_orm_descriptors
379
380 attr_keys = set(all_attrs.keys())
381
382 bulk_dml_setters = {
383 key: setter
384 for key, setter in (
385 (key, attr._bulk_dml_setter(key))
386 for key, attr in (
387 (key, _entity_namespace_key(mapper, key, default=NO_VALUE))
388 for key in attr_keys
389 )
390 if attr is not NO_VALUE and isinstance(attr, PropComparator)
391 )
392 if setter is not None
393 }
394 setters_todo = set(bulk_dml_setters)
395 if not setters_todo:
396 return
397
398 for mapping in mappings:
399 for key in setters_todo.intersection(mapping):
400 bulk_dml_setters[key](mapping)
401
402
403class _ORMDMLState(_AbstractORMCompileState):

Callers 2

_bulk_insertFunction · 0.85
_bulk_updateFunction · 0.85

Calls 4

_entity_namespace_keyFunction · 0.85
keysMethod · 0.45
_bulk_dml_setterMethod · 0.45
intersectionMethod · 0.45

Tested by

no test coverage detected