Skip to content

Conversation

@YuriiMotov
Copy link
Member

Currently session.exec(text("")) works, but leads to static type checker error:

error: No overload variant of "exec" of "Session" matches argument type "TextClause"  [call-overload]
note: Possible overload variants:
note:     def [_TSelectParam: Any] exec(self, statement: Select[_TSelectParam], *, params: Union[Mapping[str, Any], Sequence[Mapping[str, Any]], None] = ..., execution_options: Mapping[str, Any] = ..., bind_arguments: Optional[dict[str, Any]] = ..., _parent_execute_state: Optional[Any] = ..., _add_event: Optional[Any] = ...) -> TupleResult[_TSelectParam]
note:     def [_TSelectParam: Any] exec(self, statement: SelectOfScalar[_TSelectParam], *, params: Union[Mapping[str, Any], Sequence[Mapping[str, Any]], None] = ..., execution_options: Mapping[str, Any] = ..., bind_arguments: Optional[dict[str, Any]] = ..., _parent_execute_state: Optional[Any] = ..., _add_event: Optional[Any] = ...) -> ScalarResult[_TSelectParam]
note:     def exec(self, statement: UpdateBase, *, params: Union[Mapping[str, Any], Sequence[Mapping[str, Any]], None] = ..., execution_options: Mapping[str, Any] = ..., bind_arguments: Optional[dict[str, Any]] = ..., _parent_execute_state: Optional[Any] = ..., _add_event: Optional[Any] = ...) -> CursorResult[Any]

This PR adds overload for Session.exec and AsyncSession.exec to fix this.

Addresses #376

@YuriiMotov YuriiMotov added the feature New feature or request label Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant