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,
)
| 5888 | |
| 5889 | @_generative |
| 5890 | def join_from( |
| 5891 | self, |
| 5892 | from_: _FromClauseArgument, |
| 5893 | target: _JoinTargetArgument, |
| 5894 | onclause: Optional[_OnClauseArgument] = None, |
| 5895 | *, |
| 5896 | isouter: bool = False, |
| 5897 | full: bool = False, |
| 5898 | ) -> Self: |
| 5899 | r"""Create a SQL JOIN against this :class:`_expression.Select` |
| 5900 | object's criterion |
| 5901 | and apply generatively, returning the newly resulting |
| 5902 | :class:`_expression.Select`. |
| 5903 | |
| 5904 | E.g.:: |
| 5905 | |
| 5906 | stmt = select(user_table, address_table).join_from( |
| 5907 | user_table, address_table, user_table.c.id == address_table.c.user_id |
| 5908 | ) |
| 5909 | |
| 5910 | The above statement generates SQL similar to: |
| 5911 | |
| 5912 | .. sourcecode:: sql |
| 5913 | |
| 5914 | SELECT user.id, user.name, address.id, address.email, address.user_id |
| 5915 | FROM user JOIN address ON user.id = address.user_id |
| 5916 | |
| 5917 | .. versionadded:: 1.4 |
| 5918 | |
| 5919 | :param from\_: the left side of the join, will be rendered in the |
| 5920 | FROM clause and is roughly equivalent to using the |
| 5921 | :meth:`.Select.select_from` method. |
| 5922 | |
| 5923 | :param target: target table to join towards |
| 5924 | |
| 5925 | :param onclause: ON clause of the join. |
| 5926 | |
| 5927 | :param isouter: if True, generate LEFT OUTER join. Same as |
| 5928 | :meth:`_expression.Select.outerjoin`. |
| 5929 | |
| 5930 | :param full: if True, generate FULL OUTER join. |
| 5931 | |
| 5932 | .. seealso:: |
| 5933 | |
| 5934 | :ref:`tutorial_select_join` - in the :doc:`/tutorial/index` |
| 5935 | |
| 5936 | :ref:`orm_queryguide_joins` - in the :ref:`queryguide_toplevel` |
| 5937 | |
| 5938 | :meth:`_expression.Select.join` |
| 5939 | |
| 5940 | """ # noqa: E501 |
| 5941 | |
| 5942 | # note the order of parsing from vs. target is important here, as we |
| 5943 | # are also deriving the source of the plugin (i.e. the subject mapper |
| 5944 | # in an ORM query) which should favor the "from_" over the "target" |
| 5945 | |
| 5946 | from_ = coercions.expect( |
| 5947 | roles.FromClauseRole, from_, apply_propagate_attrs=self |
no outgoing calls