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

Method populate

lib/sqlalchemy/orm/events.py:705–728  ·  view source on GitHub ↗
(
        cls,
        class_: Union[DeclarativeAttributeIntercept, DeclarativeMeta, type],
        subject: Union[ClassManager[_O], Mapper[_O]],
    )

Source from the content-addressed store, hash-verified

703
704 @classmethod
705 def populate(
706 cls,
707 class_: Union[DeclarativeAttributeIntercept, DeclarativeMeta, type],
708 subject: Union[ClassManager[_O], Mapper[_O]],
709 ) -> None:
710 for subclass in class_.__mro__:
711 if subclass in cls.all_holds:
712 collection = cls.all_holds[subclass]
713 for (
714 event_key,
715 raw,
716 propagate,
717 retval,
718 kw,
719 ) in collection.values():
720 if propagate or subclass is class_:
721 # since we can't be sure in what order different
722 # classes in a hierarchy are triggered with
723 # populate(), we rely upon _EventsHold for all event
724 # assignment, instead of using the generic propagate
725 # flag.
726 event_key.with_dispatch_target(subject).listen(
727 raw=raw, propagate=False, retval=retval, **kw
728 )
729
730
731class _InstanceEventsHold(_EventsHold[_ET]):

Callers 9

_synchronizeMethod · 0.45
_synchronizeMethod · 0.45
_process_key_switchesMethod · 0.45
_new_mapper_instanceMethod · 0.45
_collect_update_commandsFunction · 0.45
_postfetchFunction · 0.45
test_populateMethod · 0.45

Calls 3

with_dispatch_targetMethod · 0.80
valuesMethod · 0.45
listenMethod · 0.45

Tested by 2

test_populateMethod · 0.36