sqlmodel
sqlmodel copied to clipboard
✨ Add UpdateBase overload for exec method in AsyncSession and Session
To address #909
On #1349 you asked for feedbacks on your PR: I tested it and it fixed my typing errors!
Previously I had this mypy output:
src/ddd/infrastructure/manager.py:263: error: No overload variant of "exec" of "Session" matches argument type "Update" [call-overload]
src/ddd/infrastructure/manager.py:263: note: Possible overload variants:
src/ddd/infrastructure/manager.py:263: note: def [_TSelectParam: Any] exec(self, statement: Select[_TSelectParam], *, params: Mapping[str, Any] | Sequence[Mapping[str, Any]] | None = ..., execution_options: Mapping[str, Any] = ..., bind_arguments: dict[str, Any] | None = ..., _parent_execute_state: Any | None = ..., _add_event: Any | None = ...) -> TupleResult[_TSelectParam]
src/ddd/infrastructure/manager.py:263: note: def [_TSelectParam: Any] exec(self, statement: SelectOfScalar[_TSelectParam], *, params: Mapping[str, Any] | Sequence[Mapping[str, Any]] | None = ..., execution_options: Mapping[str, Any] = ..., bind_arguments: dict[str, Any] | None = ..., _parent_execute_state: Any | None = ..., _add_event: Any | None = ...) -> ScalarResult[_TSelectParam]
After applying your patch, the type error is solved. Thanks a lot, hope your patch will be merged soon so everyone can benefit from this typing fix in sqlmodel :star2:
Hope this gets merged soon! Good job @seriaati