(
self,
compile_state,
column,
entities_collection,
parententity,
raw_column_index,
is_current_entities,
parent_bundle=None,
)
| 3188 | ) |
| 3189 | |
| 3190 | def __init__( |
| 3191 | self, |
| 3192 | compile_state, |
| 3193 | column, |
| 3194 | entities_collection, |
| 3195 | parententity, |
| 3196 | raw_column_index, |
| 3197 | is_current_entities, |
| 3198 | parent_bundle=None, |
| 3199 | ): |
| 3200 | annotations = column._annotations |
| 3201 | |
| 3202 | _entity = parententity |
| 3203 | |
| 3204 | # an AliasedClass won't have proxy_key in the annotations for |
| 3205 | # a column if it was acquired using the class' adapter directly, |
| 3206 | # such as using AliasedInsp._adapt_element(). this occurs |
| 3207 | # within internal loaders. |
| 3208 | |
| 3209 | orm_key = annotations.get("proxy_key", None) |
| 3210 | proxy_owner = annotations.get("proxy_owner", _entity) |
| 3211 | if orm_key: |
| 3212 | self.expr = getattr(proxy_owner.entity, orm_key) |
| 3213 | self.translate_raw_column = False |
| 3214 | else: |
| 3215 | # if orm_key is not present, that means this is an ad-hoc |
| 3216 | # SQL ColumnElement, like a CASE() or other expression. |
| 3217 | # include this column position from the invoked statement |
| 3218 | # in the ORM-level ResultSetMetaData on each execute, so that |
| 3219 | # it can be targeted by identity after caching |
| 3220 | self.expr = column |
| 3221 | self.translate_raw_column = raw_column_index is not None |
| 3222 | |
| 3223 | self.raw_column_index = raw_column_index |
| 3224 | |
| 3225 | if is_current_entities: |
| 3226 | if parent_bundle: |
| 3227 | self._label_name = orm_key if orm_key else column._proxy_key |
| 3228 | else: |
| 3229 | self._label_name = compile_state._label_convention( |
| 3230 | column, col_name=orm_key |
| 3231 | ) |
| 3232 | else: |
| 3233 | self._label_name = None |
| 3234 | |
| 3235 | _entity._post_inspect |
| 3236 | self.entity_zero = self.entity_zero_or_selectable = ezero = _entity |
| 3237 | self.mapper = mapper = _entity.mapper |
| 3238 | |
| 3239 | if parent_bundle: |
| 3240 | parent_bundle._entities.append(self) |
| 3241 | else: |
| 3242 | entities_collection.append(self) |
| 3243 | |
| 3244 | compile_state._has_orm_entities = True |
| 3245 | |
| 3246 | self.column = column |
| 3247 |
nothing calls this directly
no test coverage detected