MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / correlate

Method correlate

lib/sqlalchemy/sql/selectable.py:7111–7144  ·  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

7109
7110 @_generative
7111 def correlate(
7112 self,
7113 *fromclauses: Union[Literal[None, False], _FromClauseArgument],
7114 ) -> Self:
7115 r"""Return a new :class:`_expression.ScalarSelect`
7116 which will correlate the given FROM
7117 clauses to that of an enclosing :class:`_expression.Select`.
7118
7119 This method is mirrored from the :meth:`_sql.Select.correlate` method
7120 of the underlying :class:`_sql.Select`. The method applies the
7121 :meth:_sql.Select.correlate` method, then returns a new
7122 :class:`_sql.ScalarSelect` against that statement.
7123
7124 .. versionadded:: 1.4 Previously, the
7125 :meth:`_sql.ScalarSelect.correlate`
7126 method was only available from :class:`_sql.Select`.
7127
7128 :param \*fromclauses: a list of one or more
7129 :class:`_expression.FromClause`
7130 constructs, or other compatible constructs (i.e. ORM-mapped
7131 classes) to become part of the correlate collection.
7132
7133 .. seealso::
7134
7135 :meth:`_expression.ScalarSelect.correlate_except`
7136
7137 :ref:`tutorial_scalar_subquery` - in the 2.0 tutorial
7138
7139
7140 """
7141 self.element = cast(
7142 "Select[Unpack[TupleAny]]", self.element
7143 ).correlate(*fromclauses)
7144 return self
7145
7146 @_generative
7147 def correlate_except(

Callers

nothing calls this directly

Calls 2

castFunction · 0.70
correlateMethod · 0.45

Tested by

no test coverage detected