From 1504aa9f9f95964ee73030a76941b8169e04d5bc Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 8 Mar 2023 12:35:27 -0500 Subject: Use independent TypeVar for ColumnElement.cast Fixed typing issue where :meth:`.ColumnElement.cast` did not allow a :class:`.TypeEngine` argument independent of the type of the :class:`.ColumnElement` itself, which is the purpose of :meth:`.ColumnElement.cast`. Fixes: #9451 Change-Id: I68119c6a9e8bf896715eea79be2b4f36b1c141de --- lib/sqlalchemy/sql/elements.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql/elements.py') diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index a416b6ac0..ef4587e18 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -1635,7 +1635,7 @@ class ColumnElement( co._is_clone_of = selectable._is_clone_of.columns.get(key) return key, co - def cast(self, type_: _TypeEngineArgument[_T]) -> Cast[_T]: + def cast(self, type_: _TypeEngineArgument[_OPT]) -> Cast[_OPT]: """Produce a type cast, i.e. ``CAST( AS )``. This is a shortcut to the :func:`_expression.cast` function. -- cgit v1.2.1