_JoinTargetElement = Union["FromClause", _JoinTargetProtocol]
_OnClauseElement = Union["ColumnElement[bool]", _JoinTargetProtocol]
+_ForUpdateOfArgument = Union[
+ # single column, Table, ORM Entity
+ Union[
+ "_ColumnExpressionArgument[Any]",
+ "_FromClauseArgument",
+ ],
+ # or sequence of single column elements
+ Sequence["_ColumnExpressionArgument[Any]"],
+]
+
_SetupJoinsElement = Tuple[
_JoinTargetElement,
*,
nowait: bool = False,
read: bool = False,
- of: Optional[
- Union[
- _ColumnExpressionArgument[Any],
- Sequence[_ColumnExpressionArgument[Any]],
- ]
- ] = None,
+ of: Optional[_ForUpdateOfArgument] = None,
skip_locked: bool = False,
key_share: bool = False,
):
*,
nowait: bool = False,
read: bool = False,
- of: Optional[
- Union[
- _ColumnExpressionArgument[Any],
- Sequence[_ColumnExpressionArgument[Any]],
- ]
- ] = None,
+ of: Optional[_ForUpdateOfArgument] = None,
skip_locked: bool = False,
key_share: bool = False,
) -> SelfGenerativeSelect:
``FOR SHARE`` on PostgreSQL. On PostgreSQL, when combined with
``nowait``, will render ``FOR SHARE NOWAIT``.
- :param of: SQL expression or list of SQL expression elements
- (typically :class:`_schema.Column`
- objects or a compatible expression) which
- will render into a ``FOR UPDATE OF`` clause; supported by PostgreSQL
- and Oracle. May render as a table or as a column depending on
- backend.
+ :param of: SQL expression or list of SQL expression elements,
+ (typically :class:`_schema.Column` objects or a compatible expression,
+ for some backends may also be a table expression) which will render
+ into a ``FOR UPDATE OF`` clause; supported by PostgreSQL Oracle, some
+ MySQL versions and possibly others. May render as a table or as a
+ column depending on backend.
:param skip_locked: boolean, will render ``FOR UPDATE SKIP LOCKED``
on Oracle and PostgreSQL dialects or ``FOR SHARE SKIP LOCKED`` if
)
# EXPECTED_TYPE: RowReturningQuery[Tuple[int]]
reveal_type(q1)
+
+# test 9174
+s9174_1 = select(User).with_for_update(of=User)
+s9174_2 = select(User).with_for_update(of=User.id)
+s9174_3 = select(User).with_for_update(of=[User.id, User.email])
+s9174_4 = select(user_table).with_for_update(of=user_table)
+s9174_5 = select(user_table).with_for_update(of=user_table.c.id)
+s9174_6 = select(user_table).with_for_update(
+ of=[user_table.c.id, user_table.c.email]
+)