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)
| 2542 | @_generative |
| 2543 | @_assertions(_no_clauseelement_condition) |
| 2544 | def select_from(self, *from_obj: _FromClauseArgument) -> Self: |
| 2545 | r"""Set the FROM clause of this :class:`.Query` explicitly. |
| 2546 | |
| 2547 | :meth:`.Query.select_from` is often used in conjunction with |
| 2548 | :meth:`.Query.join` in order to control which entity is selected |
| 2549 | from on the "left" side of the join. |
| 2550 | |
| 2551 | The entity or selectable object here effectively replaces the |
| 2552 | "left edge" of any calls to :meth:`~.Query.join`, when no |
| 2553 | joinpoint is otherwise established - usually, the default "join |
| 2554 | point" is the leftmost entity in the :class:`~.Query` object's |
| 2555 | list of entities to be selected. |
| 2556 | |
| 2557 | A typical example:: |
| 2558 | |
| 2559 | q = ( |
| 2560 | session.query(Address) |
| 2561 | .select_from(User) |
| 2562 | .join(User.addresses) |
| 2563 | .filter(User.name == "ed") |
| 2564 | ) |
| 2565 | |
| 2566 | Which produces SQL equivalent to: |
| 2567 | |
| 2568 | .. sourcecode:: sql |
| 2569 | |
| 2570 | SELECT address.* FROM user |
| 2571 | JOIN address ON user.id=address.user_id |
| 2572 | WHERE user.name = :name_1 |
| 2573 | |
| 2574 | :param \*from_obj: collection of one or more entities to apply |
| 2575 | to the FROM clause. Entities can be mapped classes, |
| 2576 | :class:`.AliasedClass` objects, :class:`.Mapper` objects |
| 2577 | as well as core :class:`.FromClause` elements like subqueries. |
| 2578 | |
| 2579 | .. seealso:: |
| 2580 | |
| 2581 | :meth:`~.Query.join` |
| 2582 | |
| 2583 | :meth:`.Query.select_entity_from` |
| 2584 | |
| 2585 | :meth:`_sql.Select.select_from` - v2 equivalent method. |
| 2586 | |
| 2587 | """ |
| 2588 | |
| 2589 | self._set_select_from(from_obj, False) |
| 2590 | return self |
| 2591 | |
| 2592 | @overload |
| 2593 | def __getitem__(self, item: slice) -> List[_T]: ... |