mapper/class/AliasedClass entity
| 2813 | |
| 2814 | |
| 2815 | class _MapperEntity(_QueryEntity): |
| 2816 | """mapper/class/AliasedClass entity""" |
| 2817 | |
| 2818 | __slots__ = ( |
| 2819 | "expr", |
| 2820 | "mapper", |
| 2821 | "entity_zero", |
| 2822 | "is_aliased_class", |
| 2823 | "path", |
| 2824 | "_extra_entities", |
| 2825 | "_label_name", |
| 2826 | "_with_polymorphic_mappers", |
| 2827 | "selectable", |
| 2828 | "_polymorphic_discriminator", |
| 2829 | ) |
| 2830 | |
| 2831 | expr: _InternalEntityType |
| 2832 | mapper: Mapper[Any] |
| 2833 | entity_zero: _InternalEntityType |
| 2834 | is_aliased_class: bool |
| 2835 | path: PathRegistry |
| 2836 | _label_name: str |
| 2837 | |
| 2838 | def __init__( |
| 2839 | self, compile_state, entity, entities_collection, is_current_entities |
| 2840 | ): |
| 2841 | entities_collection.append(self) |
| 2842 | if is_current_entities: |
| 2843 | if compile_state._primary_entity is None: |
| 2844 | compile_state._primary_entity = self |
| 2845 | compile_state._has_mapper_entities = True |
| 2846 | compile_state._has_orm_entities = True |
| 2847 | |
| 2848 | entity = entity._annotations["parententity"] |
| 2849 | entity._post_inspect |
| 2850 | ext_info = self.entity_zero = entity |
| 2851 | entity = ext_info.entity |
| 2852 | |
| 2853 | self.expr = entity |
| 2854 | self.mapper = mapper = ext_info.mapper |
| 2855 | |
| 2856 | self._extra_entities = (self.expr,) |
| 2857 | |
| 2858 | if ext_info.is_aliased_class: |
| 2859 | self._label_name = ext_info.name |
| 2860 | else: |
| 2861 | self._label_name = mapper.class_.__name__ |
| 2862 | |
| 2863 | self.is_aliased_class = ext_info.is_aliased_class |
| 2864 | self.path = ext_info._path_registry |
| 2865 | |
| 2866 | self.selectable = ext_info.selectable |
| 2867 | self._with_polymorphic_mappers = ext_info.with_polymorphic_mappers |
| 2868 | self._polymorphic_discriminator = ext_info.polymorphic_on |
| 2869 | |
| 2870 | if mapper._should_select_with_poly_adapter: |
| 2871 | compile_state._create_with_polymorphic_adapter( |
| 2872 | ext_info, self.selectable |