r"""Create a SQL JOIN against this :class:`_expression.Select` object's criterion and apply generatively, returning the newly resulting :class:`_expression.Select`. E.g.:: stmt = select(user_table, address_table).join_from( user_table, ad
(
self,
from_: _FromClauseArgument,
target: _JoinTargetArgument,
onclause: Optional[_OnClauseArgument] = None,
*,
isouter: bool = False,
full: bool = False,
)
| 5633 | |
| 5634 | @_generative |
| 5635 | def join_from( |
| 5636 | self, |
| 5637 | from_: _FromClauseArgument, |
| 5638 | target: _JoinTargetArgument, |
| 5639 | onclause: Optional[_OnClauseArgument] = None, |
| 5640 | *, |
| 5641 | isouter: bool = False, |
| 5642 | full: bool = False, |
| 5643 | ) -> Self: |
| 5644 | r"""Create a SQL JOIN against this :class:`_expression.Select` |
| 5645 | object's criterion |
| 5646 | and apply generatively, returning the newly resulting |
| 5647 | :class:`_expression.Select`. |
| 5648 | |
| 5649 | E.g.:: |
| 5650 | |
| 5651 | stmt = select(user_table, address_table).join_from( |
| 5652 | user_table, address_table, user_table.c.id == address_table.c.user_id |
| 5653 | ) |
| 5654 | |
| 5655 | The above statement generates SQL similar to: |
| 5656 | |
| 5657 | .. sourcecode:: sql |
| 5658 | |
| 5659 | SELECT user.id, user.name, address.id, address.email, address.user_id |
| 5660 | FROM user JOIN address ON user.id = address.user_id |
| 5661 | |
| 5662 | .. versionadded:: 1.4 |
| 5663 | |
| 5664 | :param from\_: the left side of the join, will be rendered in the |
| 5665 | FROM clause and is roughly equivalent to using the |
| 5666 | :meth:`.Select.select_from` method. |
| 5667 | |
| 5668 | :param target: target table to join towards |
| 5669 | |
| 5670 | :param onclause: ON clause of the join. |
| 5671 | |
| 5672 | :param isouter: if True, generate LEFT OUTER join. Same as |
| 5673 | :meth:`_expression.Select.outerjoin`. |
| 5674 | |
| 5675 | :param full: if True, generate FULL OUTER join. |
| 5676 | |
| 5677 | .. seealso:: |
| 5678 | |
| 5679 | :ref:`tutorial_select_join` - in the :doc:`/tutorial/index` |
| 5680 | |
| 5681 | :ref:`orm_queryguide_joins` - in the :ref:`queryguide_toplevel` |
| 5682 | |
| 5683 | :meth:`_expression.Select.join` |
| 5684 | |
| 5685 | """ # noqa: E501 |
| 5686 | |
| 5687 | # note the order of parsing from vs. target is important here, as we |
| 5688 | # are also deriving the source of the plugin (i.e. the subject mapper |
| 5689 | # in an ORM query) which should favor the "from_" over the "target" |
| 5690 | |
| 5691 | from_ = coercions.expect( |
| 5692 | roles.FromClauseRole, from_, apply_propagate_attrs=self |
no outgoing calls