MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _setup_joins

Method _setup_joins

lib/sqlalchemy/sql/selectable.py:5188–5249  ·  view source on GitHub ↗
(
        self,
        args: Tuple[_SetupJoinsElement, ...],
        raw_columns: List[_ColumnsClauseElement],
    )

Source from the content-addressed store, hash-verified

5186 return [c for c in _select_iterables(statement._raw_columns)]
5187
5188 def _setup_joins(
5189 self,
5190 args: Tuple[_SetupJoinsElement, ...],
5191 raw_columns: List[_ColumnsClauseElement],
5192 ) -> None:
5193 for right, onclause, left, flags in args:
5194 if TYPE_CHECKING:
5195 if onclause is not None:
5196 assert isinstance(onclause, ColumnElement)
5197
5198 explicit_left = left
5199 isouter = flags["isouter"]
5200 full = flags["full"]
5201
5202 if left is None:
5203 (
5204 left,
5205 replace_from_obj_index,
5206 ) = self._join_determine_implicit_left_side(
5207 raw_columns, left, right, onclause
5208 )
5209 else:
5210 replace_from_obj_index = self._join_place_explicit_left_side(
5211 left
5212 )
5213
5214 # these assertions can be made here, as if the right/onclause
5215 # contained ORM elements, the select() statement would have been
5216 # upgraded to an ORM select, and this method would not be called;
5217 # orm.context.ORMSelectCompileState._join() would be
5218 # used instead.
5219 if TYPE_CHECKING:
5220 assert isinstance(right, FromClause)
5221 if onclause is not None:
5222 assert isinstance(onclause, ColumnElement)
5223
5224 if replace_from_obj_index is not None:
5225 # splice into an existing element in the
5226 # self._from_obj list
5227 left_clause = self.from_clauses[replace_from_obj_index]
5228
5229 if explicit_left is not None and onclause is None:
5230 onclause = Join._join_condition(explicit_left, right)
5231
5232 self.from_clauses = (
5233 self.from_clauses[:replace_from_obj_index]
5234 + (
5235 Join(
5236 left_clause,
5237 right,
5238 onclause,
5239 isouter=isouter,
5240 full=full,
5241 ),
5242 )
5243 + self.from_clauses[replace_from_obj_index + 1 :]
5244 )
5245 else:

Callers 1

__init__Method · 0.95

Calls 4

JoinClass · 0.85
_join_conditionMethod · 0.80

Tested by

no test coverage detected