MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / correlate_except

Method correlate_except

lib/sqlalchemy/sql/selectable.py:6703–6748  ·  view source on GitHub ↗

r"""Return a new :class:`_expression.Select` which will omit the given FROM clauses from the auto-correlation process. Calling :meth:`_expression.Select.correlate_except` turns off the :class:`_expression.Select` object's default behavior of "auto-correlation

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

Source from the content-addressed store, hash-verified

6701
6702 @_generative
6703 def correlate_except(
6704 self,
6705 *fromclauses: Union[Literal[None, False], _FromClauseArgument],
6706 ) -> Self:
6707 r"""Return a new :class:`_expression.Select`
6708 which will omit the given FROM
6709 clauses from the auto-correlation process.
6710
6711 Calling :meth:`_expression.Select.correlate_except` turns off the
6712 :class:`_expression.Select` object's default behavior of
6713 "auto-correlation" for the given FROM elements. An element
6714 specified here will unconditionally appear in the FROM list, while
6715 all other FROM elements remain subject to normal auto-correlation
6716 behaviors.
6717
6718 If ``None`` is passed, or no arguments are passed,
6719 the :class:`_expression.Select` object will correlate all of its
6720 FROM entries.
6721
6722 :param \*fromclauses: a list of one or more
6723 :class:`_expression.FromClause`
6724 constructs, or other compatible constructs (i.e. ORM-mapped
6725 classes) to become part of the correlate-exception collection.
6726
6727 .. seealso::
6728
6729 :meth:`_expression.Select.correlate`
6730
6731 :ref:`tutorial_scalar_subquery`
6732
6733 """
6734
6735 self._auto_correlate = False
6736 if not fromclauses or fromclauses[0] in {None, False}:
6737 if len(fromclauses) > 1:
6738 raise exc.ArgumentError(
6739 "additional FROM objects not accepted when "
6740 "passing None/False to correlate_except()"
6741 )
6742 self._correlate_except = ()
6743 else:
6744 self._correlate_except = (self._correlate_except or ()) + tuple(
6745 coercions.expect(roles.FromClauseRole, f) for f in fromclauses
6746 )
6747
6748 return self
6749
6750 @HasMemoized_ro_memoized_attribute
6751 def selected_columns(

Calls

no outgoing calls