MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / correlate

Method correlate

lib/sqlalchemy/sql/selectable.py:6820–6853  ·  view source on GitHub ↗

r"""Return a new :class:`_expression.ScalarSelect` which will correlate the given FROM clauses to that of an enclosing :class:`_expression.Select`. This method is mirrored from the :meth:`_sql.Select.correlate` method of the underlying :class:`_sql.Select`. The meth

(
        self,
        *fromclauses: Union[Literal[None, False], _FromClauseArgument],
    )

Source from the content-addressed store, hash-verified

6818
6819 @_generative
6820 def correlate(
6821 self,
6822 *fromclauses: Union[Literal[None, False], _FromClauseArgument],
6823 ) -> Self:
6824 r"""Return a new :class:`_expression.ScalarSelect`
6825 which will correlate the given FROM
6826 clauses to that of an enclosing :class:`_expression.Select`.
6827
6828 This method is mirrored from the :meth:`_sql.Select.correlate` method
6829 of the underlying :class:`_sql.Select`. The method applies the
6830 :meth:_sql.Select.correlate` method, then returns a new
6831 :class:`_sql.ScalarSelect` against that statement.
6832
6833 .. versionadded:: 1.4 Previously, the
6834 :meth:`_sql.ScalarSelect.correlate`
6835 method was only available from :class:`_sql.Select`.
6836
6837 :param \*fromclauses: a list of one or more
6838 :class:`_expression.FromClause`
6839 constructs, or other compatible constructs (i.e. ORM-mapped
6840 classes) to become part of the correlate collection.
6841
6842 .. seealso::
6843
6844 :meth:`_expression.ScalarSelect.correlate_except`
6845
6846 :ref:`tutorial_scalar_subquery` - in the 2.0 tutorial
6847
6848
6849 """
6850 self.element = cast("Select[Any]", self.element).correlate(
6851 *fromclauses
6852 )
6853 return self
6854
6855 @_generative
6856 def correlate_except(

Callers

nothing calls this directly

Calls 2

castFunction · 0.85
correlateMethod · 0.45

Tested by

no test coverage detected