diff options
author | Federico Caselli <cfederico87@gmail.com> | 2022-11-08 22:12:47 +0100 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-11-26 18:49:06 -0500 |
commit | 61443aa62bbef158274ae393db399fec7f054c2d (patch) | |
tree | 18d8794c2da57295f7b48530457ca9e71a60dfdb /lib/sqlalchemy/sql/elements.py | |
parent | 5cc3825da3cdda6bd80e4fe7250b795c15ca4be3 (diff) | |
download | sqlalchemy-61443aa62bbef158274ae393db399fec7f054c2d.tar.gz |
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
Diffstat (limited to 'lib/sqlalchemy/sql/elements.py')
-rw-r--r-- | lib/sqlalchemy/sql/elements.py | 9 |
1 files changed, 6 insertions, 3 deletions
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]: ... |