MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / join

Method join

lib/sqlalchemy/sql/selectable.py:702–753  ·  view source on GitHub ↗

Return a :class:`_expression.Join` from this :class:`_expression.FromClause` to another :class:`FromClause`. E.g.:: from sqlalchemy import join j = user_table.join( address_table, user_table.c.id == address_table.c.user_id

(
        self,
        right: _FromClauseArgument,
        onclause: Optional[_ColumnExpressionArgument[bool]] = None,
        isouter: bool = False,
        full: bool = False,
    )

Source from the content-addressed store, hash-verified

700 return Select(self)
701
702 def join(
703 self,
704 right: _FromClauseArgument,
705 onclause: Optional[_ColumnExpressionArgument[bool]] = None,
706 isouter: bool = False,
707 full: bool = False,
708 ) -> Join:
709 """Return a :class:`_expression.Join` from this
710 :class:`_expression.FromClause`
711 to another :class:`FromClause`.
712
713 E.g.::
714
715 from sqlalchemy import join
716
717 j = user_table.join(
718 address_table, user_table.c.id == address_table.c.user_id
719 )
720 stmt = select(user_table).select_from(j)
721
722 would emit SQL along the lines of:
723
724 .. sourcecode:: sql
725
726 SELECT user.id, user.name FROM user
727 JOIN address ON user.id = address.user_id
728
729 :param right: the right side of the join; this is any
730 :class:`_expression.FromClause` object such as a
731 :class:`_schema.Table` object, and
732 may also be a selectable-compatible object such as an ORM-mapped
733 class.
734
735 :param onclause: a SQL expression representing the ON clause of the
736 join. If left at ``None``, :meth:`_expression.FromClause.join`
737 will attempt to
738 join the two tables based on a foreign key relationship.
739
740 :param isouter: if True, render a LEFT OUTER JOIN, instead of JOIN.
741
742 :param full: if True, render a FULL OUTER JOIN, instead of LEFT OUTER
743 JOIN. Implies :paramref:`.FromClause.join.isouter`.
744
745 .. seealso::
746
747 :func:`_expression.join` - standalone function
748
749 :class:`_expression.Join` - the type of object produced
750
751 """
752
753 return Join(self, right, onclause, isouter, full)
754
755 def outerjoin(
756 self,

Callers

nothing calls this directly

Calls 1

JoinClass · 0.85

Tested by

no test coverage detected