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

Method setup_compile_state

lib/sqlalchemy/orm/context.py:3280–3321  ·  view source on GitHub ↗
(self, compile_state)

Source from the content-addressed store, hash-verified

3278 compile_state.primary_columns.append(column)
3279
3280 def setup_compile_state(self, compile_state):
3281 current_adapter = compile_state._get_current_adapter()
3282 if current_adapter:
3283 column = current_adapter(self.column, False)
3284 if column is None:
3285 assert compile_state.is_dml_returning
3286 self._fetch_column = self.column
3287 return
3288 else:
3289 column = self.column
3290
3291 ezero = self.entity_zero
3292
3293 single_table_crit = self.mapper._single_table_criterion
3294 if (
3295 single_table_crit is not None
3296 or ("additional_entity_criteria", self.mapper)
3297 in compile_state.global_attributes
3298 ):
3299 compile_state.extra_criteria_entities[ezero] = (
3300 ezero,
3301 ezero._adapter if ezero.is_aliased_class else None,
3302 )
3303
3304 if column._annotations and not column._expression_label:
3305 # annotated columns perform more slowly in compiler and
3306 # result due to the __eq__() method, so use deannotated
3307 column = column._deannotate()
3308
3309 # use entity_zero as the from if we have it. this is necessary
3310 # for polymorphic scenarios where our FROM is based on ORM entity,
3311 # not the FROM of the column. but also, don't use it if our column
3312 # doesn't actually have any FROMs that line up, such as when its
3313 # a scalar subquery.
3314 if set(self.column._from_objects).intersection(
3315 ezero.selectable._from_objects
3316 ):
3317 compile_state._fallback_from_clauses.append(ezero.selectable)
3318
3319 compile_state.dedupe_columns.add(column)
3320 compile_state.primary_columns.append(column)
3321 self._fetch_column = column
3322
3323
3324class _IdentityTokenEntity(_ORMColumnEntity):

Callers

nothing calls this directly

Calls 5

_get_current_adapterMethod · 0.45
_deannotateMethod · 0.45
intersectionMethod · 0.45
appendMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected