From efe8cb7ef89cf19befb9b83adadc0da8245be9ce Mon Sep 17 00:00:00 2001 From: Shamil Date: Tue, 18 Nov 2025 22:22:26 +0300 Subject: [PATCH] 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=...). --- lib/sqlalchemy/sql/selectable.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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", + ] + ], ] -- 2.47.3