From 61443aa62bbef158274ae393db399fec7f054c2d Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Tue, 8 Nov 2022 22:12:47 +0100 Subject: Implement ScalarValue Added :class:`_expression.ScalarValues` that can be used as a column element allowing using :class:`_expression.Values` inside IN clauses or in conjunction with ``ANY`` or ``ALL`` collection aggregates. This new class is generated using the method :meth:`_expression.Values.scalar_values`. The :class:`_expression.Values` instance is now coerced to a :class:`_expression.ScalarValues` when used in a ``IN`` or ``NOT IN`` operation. Fixes: #6289 Change-Id: Iac22487ccb01553684b908e54d01c0687fa739f1 --- lib/sqlalchemy/sql/elements.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/sqlalchemy/sql/elements.py') diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 914d2b326..6a9bd74ca 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -97,7 +97,6 @@ if typing.TYPE_CHECKING: from .selectable import _SelectIterable from .selectable import FromClause from .selectable import NamedFromClause - from .selectable import Select from .sqltypes import TupleType from .type_api import TypeEngine from .visitors import _CloneCallableType @@ -860,13 +859,17 @@ class SQLCoreOperations(Generic[_T], ColumnOperators, TypingOnly): def in_( self, - other: Union[Sequence[Any], BindParameter[Any], Select[Any]], + other: Union[ + Sequence[Any], BindParameter[Any], roles.InElementRole + ], ) -> BinaryExpression[bool]: ... def not_in( self, - other: Union[Sequence[Any], BindParameter[Any], Select[Any]], + other: Union[ + Sequence[Any], BindParameter[Any], roles.InElementRole + ], ) -> BinaryExpression[bool]: ... -- cgit v1.2.1