|
10 | 10 | from ..engine.result import Result, ScalarResult |
11 | 11 | from ..sql.base import Executable |
12 | 12 |
|
13 | | -_T = TypeVar("_T") |
| 13 | +_TSelectParam = TypeVar("_TSelectParam") |
14 | 14 |
|
15 | 15 |
|
16 | 16 | class Session(_Session): |
17 | 17 | @overload |
18 | 18 | def exec( |
19 | 19 | self, |
20 | | - statement: Select[_T], |
| 20 | + statement: Select[_TSelectParam], |
21 | 21 | *, |
22 | 22 | params: Optional[Union[Mapping[str, Any], Sequence[Mapping[str, Any]]]] = None, |
23 | 23 | execution_options: Mapping[str, Any] = util.EMPTY_DICT, |
24 | 24 | bind_arguments: Optional[Mapping[str, Any]] = None, |
25 | 25 | _parent_execute_state: Optional[Any] = None, |
26 | 26 | _add_event: Optional[Any] = None, |
27 | 27 | **kw: Any, |
28 | | - ) -> Union[Result[_T]]: |
| 28 | + ) -> Result[_TSelectParam]: |
29 | 29 | ... |
30 | 30 |
|
31 | 31 | @overload |
32 | 32 | def exec( |
33 | 33 | self, |
34 | | - statement: SelectOfScalar[_T], |
| 34 | + statement: SelectOfScalar[_TSelectParam], |
35 | 35 | *, |
36 | 36 | params: Optional[Union[Mapping[str, Any], Sequence[Mapping[str, Any]]]] = None, |
37 | 37 | execution_options: Mapping[str, Any] = util.EMPTY_DICT, |
38 | 38 | bind_arguments: Optional[Mapping[str, Any]] = None, |
39 | 39 | _parent_execute_state: Optional[Any] = None, |
40 | 40 | _add_event: Optional[Any] = None, |
41 | 41 | **kw: Any, |
42 | | - ) -> Union[ScalarResult[_T]]: |
| 42 | + ) -> ScalarResult[_TSelectParam]: |
43 | 43 | ... |
44 | 44 |
|
45 | 45 | def exec( |
46 | 46 | self, |
47 | | - statement: Union[Select[_T], SelectOfScalar[_T], Executable[_T]], |
| 47 | + statement: Union[ |
| 48 | + Select[_TSelectParam], |
| 49 | + SelectOfScalar[_TSelectParam], |
| 50 | + Executable[_TSelectParam], |
| 51 | + ], |
48 | 52 | *, |
49 | 53 | params: Optional[Union[Mapping[str, Any], Sequence[Mapping[str, Any]]]] = None, |
50 | 54 | execution_options: Mapping[str, Any] = util.EMPTY_DICT, |
51 | 55 | bind_arguments: Optional[Mapping[str, Any]] = None, |
52 | 56 | _parent_execute_state: Optional[Any] = None, |
53 | 57 | _add_event: Optional[Any] = None, |
54 | 58 | **kw: Any, |
55 | | - ) -> Union[Result[_T], ScalarResult[_T]]: |
| 59 | + ) -> Union[Result[_TSelectParam], ScalarResult[_TSelectParam]]: |
56 | 60 | results = super().execute( |
57 | 61 | statement, |
58 | 62 | params=params, |
@@ -118,13 +122,13 @@ def query(self, *entities: Any, **kwargs: Any) -> "_Query[Any]": |
118 | 122 |
|
119 | 123 | def get( |
120 | 124 | self, |
121 | | - entity: Type[_T], |
| 125 | + entity: Type[_TSelectParam], |
122 | 126 | ident: Any, |
123 | 127 | options: Optional[Sequence[Any]] = None, |
124 | 128 | populate_existing: bool = False, |
125 | 129 | with_for_update: Optional[Union[Literal[True], Mapping[str, Any]]] = None, |
126 | 130 | identity_token: Optional[Any] = None, |
127 | | - ) -> Optional[_T]: |
| 131 | + ) -> Optional[_TSelectParam]: |
128 | 132 | return super().get( |
129 | 133 | entity, |
130 | 134 | ident, |
|
0 commit comments