From: Shamil Date: Tue, 18 Nov 2025 19:22:26 +0000 (+0300) Subject: Fix type hint for with_for_update() to support tuples of table classes X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=efe8cb7ef89cf19befb9b83adadc0da8245be9ce;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Fix type hint for with_for_update() to support tuples of table classes Fixes #12730 Updated _ForUpdateOfArgument type alias to accept sequences of both column expressions and FROM clause arguments (tables, ORM entities). Previously only sequences of column expressions were supported, causing type checker errors when passing tuples of DeclarativeBase classes to with_for_update(of=...). --- diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index bf60995245..c212d16151 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -179,8 +179,13 @@ _ForUpdateOfArgument = Union[ "_ColumnExpressionArgument[Any]", "_FromClauseArgument", ], - # or sequence of single column elements - Sequence["_ColumnExpressionArgument[Any]"], + # or sequence of column elements or from clauses + Sequence[ + Union[ + "_ColumnExpressionArgument[Any]", + "_FromClauseArgument", + ] + ], ]