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

Method correlate_except

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

6414
6415 @_generative
6416 def correlate_except(
6417 self,
6418 *fromclauses: Union[Literal[None, False], _FromClauseArgument],
6419 ) -> Self:
6420 r"""Return a new :class:`_expression.Select`
6421 which will omit the given FROM
6422 clauses from the auto-correlation process.
6423
6424 Calling :meth:`_expression.Select.correlate_except` turns off the
6425 :class:`_expression.Select` object's default behavior of
6426 "auto-correlation" for the given FROM elements. An element
6427 specified here will unconditionally appear in the FROM list, while
6428 all other FROM elements remain subject to normal auto-correlation
6429 behaviors.
6430
6431 If ``None`` is passed, or no arguments are passed,
6432 the :class:`_expression.Select` object will correlate all of its
6433 FROM entries.
6434
6435 :param \*fromclauses: a list of one or more
6436 :class:`_expression.FromClause`
6437 constructs, or other compatible constructs (i.e. ORM-mapped
6438 classes) to become part of the correlate-exception collection.
6439
6440 .. seealso::
6441
6442 :meth:`_expression.Select.correlate`
6443
6444 :ref:`tutorial_scalar_subquery`
6445
6446 """
6447
6448 self._auto_correlate = False
6449 if not fromclauses or fromclauses[0] in {None, False}:
6450 if len(fromclauses) > 1:
6451 raise exc.ArgumentError(
6452 "additional FROM objects not accepted when "
6453 "passing None/False to correlate_except()"
6454 )
6455 self._correlate_except = ()
6456 else:
6457 self._correlate_except = (self._correlate_except or ()) + tuple(
6458 coercions.expect(roles.FromClauseRole, f) for f in fromclauses
6459 )
6460
6461 return self
6462
6463 @HasMemoized_ro_memoized_attribute
6464 def selected_columns(

Calls

no outgoing calls