r"""Set the FROM clause of this :class:`.Query` explicitly. :meth:`.Query.select_from` is often used in conjunction with :meth:`.Query.join` in order to control which entity is selected from on the "left" side of the join. The entity or selectable object here effect
(self, *from_obj: _FromClauseArgument)
| 2512 | @_generative |
| 2513 | @_assertions(_no_clauseelement_condition) |
| 2514 | def select_from(self, *from_obj: _FromClauseArgument) -> Self: |
| 2515 | r"""Set the FROM clause of this :class:`.Query` explicitly. |
| 2516 | |
| 2517 | :meth:`.Query.select_from` is often used in conjunction with |
| 2518 | :meth:`.Query.join` in order to control which entity is selected |
| 2519 | from on the "left" side of the join. |
| 2520 | |
| 2521 | The entity or selectable object here effectively replaces the |
| 2522 | "left edge" of any calls to :meth:`~.Query.join`, when no |
| 2523 | joinpoint is otherwise established - usually, the default "join |
| 2524 | point" is the leftmost entity in the :class:`~.Query` object's |
| 2525 | list of entities to be selected. |
| 2526 | |
| 2527 | A typical example:: |
| 2528 | |
| 2529 | q = ( |
| 2530 | session.query(Address) |
| 2531 | .select_from(User) |
| 2532 | .join(User.addresses) |
| 2533 | .filter(User.name == "ed") |
| 2534 | ) |
| 2535 | |
| 2536 | Which produces SQL equivalent to: |
| 2537 | |
| 2538 | .. sourcecode:: sql |
| 2539 | |
| 2540 | SELECT address.* FROM user |
| 2541 | JOIN address ON user.id=address.user_id |
| 2542 | WHERE user.name = :name_1 |
| 2543 | |
| 2544 | :param \*from_obj: collection of one or more entities to apply |
| 2545 | to the FROM clause. Entities can be mapped classes, |
| 2546 | :class:`.AliasedClass` objects, :class:`.Mapper` objects |
| 2547 | as well as core :class:`.FromClause` elements like subqueries. |
| 2548 | |
| 2549 | .. seealso:: |
| 2550 | |
| 2551 | :meth:`~.Query.join` |
| 2552 | |
| 2553 | :meth:`.Query.select_entity_from` |
| 2554 | |
| 2555 | :meth:`_sql.Select.select_from` - v2 equivalent method. |
| 2556 | |
| 2557 | """ |
| 2558 | |
| 2559 | self._set_select_from(from_obj, False) |
| 2560 | return self |
| 2561 | |
| 2562 | @overload |
| 2563 | def __getitem__(self, item: slice) -> List[_T]: ... |