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

Method __init__

lib/sqlalchemy/orm/context.py:2697–2732  ·  view source on GitHub ↗
(
        self, compile_state, entity, entities_collection, is_current_entities
    )

Source from the content-addressed store, hash-verified

2695 _label_name: str
2696
2697 def __init__(
2698 self, compile_state, entity, entities_collection, is_current_entities
2699 ):
2700 entities_collection.append(self)
2701 if is_current_entities:
2702 if compile_state._primary_entity is None:
2703 compile_state._primary_entity = self
2704 compile_state._has_mapper_entities = True
2705 compile_state._has_orm_entities = True
2706
2707 entity = entity._annotations["parententity"]
2708 entity._post_inspect
2709 ext_info = self.entity_zero = entity
2710 entity = ext_info.entity
2711
2712 self.expr = entity
2713 self.mapper = mapper = ext_info.mapper
2714
2715 self._extra_entities = (self.expr,)
2716
2717 if ext_info.is_aliased_class:
2718 self._label_name = ext_info.name
2719 else:
2720 self._label_name = mapper.class_.__name__
2721
2722 self.is_aliased_class = ext_info.is_aliased_class
2723 self.path = ext_info._path_registry
2724
2725 self.selectable = ext_info.selectable
2726 self._with_polymorphic_mappers = ext_info.with_polymorphic_mappers
2727 self._polymorphic_discriminator = ext_info.polymorphic_on
2728
2729 if mapper._should_select_with_poly_adapter:
2730 compile_state._create_with_polymorphic_adapter(
2731 ext_info, self.selectable
2732 )
2733
2734 supports_single_entity = True
2735

Callers

nothing calls this directly

Calls 2

appendMethod · 0.45

Tested by

no test coverage detected