MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _BundleEntity

Class _BundleEntity

lib/sqlalchemy/orm/context.py:2987–3114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2985
2986
2987class _BundleEntity(_QueryEntity):
2988 _extra_entities = ()
2989
2990 __slots__ = (
2991 "bundle",
2992 "expr",
2993 "type",
2994 "_label_name",
2995 "_entities",
2996 "supports_single_entity",
2997 )
2998
2999 _entities: List[_QueryEntity]
3000 bundle: Bundle
3001 type: Type[Any]
3002 _label_name: str
3003 supports_single_entity: bool
3004 expr: Bundle
3005
3006 def __init__(
3007 self,
3008 compile_state,
3009 expr,
3010 entities_collection,
3011 is_current_entities,
3012 setup_entities=True,
3013 parent_bundle=None,
3014 ):
3015 compile_state._has_orm_entities = True
3016
3017 expr = expr._annotations["bundle"]
3018 if parent_bundle:
3019 parent_bundle._entities.append(self)
3020 else:
3021 entities_collection.append(self)
3022
3023 if isinstance(
3024 expr, (attributes.QueryableAttribute, interfaces.PropComparator)
3025 ):
3026 bundle = expr.__clause_element__()
3027 else:
3028 bundle = expr
3029
3030 self.bundle = self.expr = bundle
3031 self.type = type(bundle)
3032 self._label_name = bundle.name
3033 self._entities = []
3034
3035 if setup_entities:
3036 for expr in bundle.exprs:
3037 if "bundle" in expr._annotations:
3038 _BundleEntity(
3039 compile_state,
3040 expr,
3041 entities_collection,
3042 is_current_entities,
3043 parent_bundle=self,
3044 )

Callers 2

to_compile_stateMethod · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected