MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / setup_compile_state

Method setup_compile_state

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

Source from the content-addressed store, hash-verified

3419 compile_state.primary_columns.append(column)
3420
3421 def setup_compile_state(self, compile_state):
3422 current_adapter = compile_state._get_current_adapter()
3423 if current_adapter:
3424 column = current_adapter(self.column, False)
3425 if column is None:
3426 assert compile_state.is_dml_returning
3427 self._fetch_column = self.column
3428 return
3429 else:
3430 column = self.column
3431
3432 ezero = self.entity_zero
3433
3434 single_table_crit = self.mapper._single_table_criterion
3435 if (
3436 single_table_crit is not None
3437 or ("additional_entity_criteria", self.mapper)
3438 in compile_state.global_attributes
3439 ):
3440 compile_state.extra_criteria_entities[ezero] = (
3441 ezero,
3442 ezero._adapter if ezero.is_aliased_class else None,
3443 )
3444
3445 if column._annotations and not column._expression_label:
3446 # annotated columns perform more slowly in compiler and
3447 # result due to the __eq__() method, so use deannotated
3448 column = column._deannotate()
3449
3450 # use entity_zero as the from if we have it. this is necessary
3451 # for polymorphic scenarios where our FROM is based on ORM entity,
3452 # not the FROM of the column. but also, don't use it if our column
3453 # doesn't actually have any FROMs that line up, such as when its
3454 # a scalar subquery.
3455 if set(self.column._from_objects).intersection(
3456 ezero.selectable._from_objects
3457 ):
3458 compile_state._fallback_from_clauses.append(ezero.selectable)
3459
3460 compile_state.dedupe_columns.add(column)
3461 compile_state.primary_columns.append(column)
3462 self._fetch_column = column
3463
3464
3465class _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