1
1
from typing import Any
2
- from typing import Dict
3
2
from typing import List
4
3
from typing import MutableMapping
5
4
from typing import Optional
@@ -18,7 +17,8 @@ from .interfaces import ExceptionContext
18
17
from .interfaces import ExecutionContext
19
18
from .url import URL
20
19
from .. import log
21
- from .. import util
20
+ from .._typing import _ExecuteOptions
21
+ from .._typing import _ExecuteParams
22
22
from ..exc import StatementError
23
23
from ..pool import Pool
24
24
@@ -29,8 +29,6 @@ _TConnection = TypeVar("_TConnection", bound=Connection)
29
29
_TTransaction = TypeVar ("_TTransaction" , bound = Transaction )
30
30
_TEngine = TypeVar ("_TEngine" , bound = Engine )
31
31
32
- _ExecutionOptions : util .immutabledict [Any , Any ]
33
-
34
32
class _ConnectionCallable (Protocol [_T_contra , _T_co ]):
35
33
def __call__ (
36
34
self , __connection : _T_contra , * args : Any , ** kwargs : Any
@@ -55,15 +53,15 @@ class Connection(_ConnectionTypingCommon, Connectable):
55
53
connection : Optional [_DBAPIConnection ] = ...,
56
54
close_with_result : bool = ...,
57
55
_branch_from : Optional [Any ] = ...,
58
- _execution_options : Optional [Dict [ str , Any ] ] = ...,
56
+ _execution_options : Optional [_ExecuteOptions ] = ...,
59
57
_dispatch : Optional [Any ] = ...,
60
58
_has_events : Optional [Any ] = ...,
61
59
) -> None : ...
62
60
def schema_for_object (self , obj : Any ) -> str : ...
63
61
def __enter__ (self : _TConnection ) -> _TConnection : ...
64
62
def __exit__ (self , type_ : Any , value : Any , traceback : Any ) -> None : ...
65
63
def execution_options (self : _TConnection , ** opt : Any ) -> _TConnection : ...
66
- def get_execution_options (self ) -> Dict [ str , Any ] : ...
64
+ def get_execution_options (self ) -> _ExecuteOptions : ...
67
65
@property
68
66
def connection (self ) -> _DBAPIConnection : ...
69
67
def get_isolation_level (self ) -> Any : ...
@@ -92,8 +90,8 @@ class Connection(_ConnectionTypingCommon, Connectable):
92
90
def exec_driver_sql (
93
91
self ,
94
92
statement : str ,
95
- parameters : Optional [Any ] = ...,
96
- execution_options : Optional [Any ] = ...,
93
+ parameters : Optional [_ExecuteParams ] = ...,
94
+ execution_options : Optional [_ExecuteOptions ] = ...,
97
95
) -> CursorResult : ...
98
96
def transaction (
99
97
self : _TConnection ,
@@ -176,7 +174,7 @@ class _EngineTypingCommon:
176
174
def driver (self ) -> str : ...
177
175
def clear_compiled_cache (self ) -> None : ...
178
176
def update_execution_options (self , ** opt : Any ) -> None : ...
179
- def get_execution_options (self ) -> Dict [ str , Any ] : ...
177
+ def get_execution_options (self ) -> _ExecuteOptions : ...
180
178
181
179
class Engine (_EngineTypingCommon , Connectable , log .Identified ):
182
180
@property
@@ -190,7 +188,7 @@ class Engine(_EngineTypingCommon, Connectable, log.Identified):
190
188
logging_name : Optional [str ] = ...,
191
189
echo : Optional [Union [bool , Literal ["debug" ]]] = ...,
192
190
query_cache_size : int = ...,
193
- execution_options : Optional [Dict [ str , Any ] ] = ...,
191
+ execution_options : Optional [_ExecuteOptions ] = ...,
194
192
hide_parameters : bool = ...,
195
193
) -> None : ...
196
194
def execution_options (self , ** opt : Any ) -> OptionEngine : ...
@@ -248,7 +246,7 @@ class OptionEngineMixin:
248
246
dispatch : Any = ...
249
247
pool : Pool = ...
250
248
def __init__ (
251
- self , proxied : Engine , execution_options : Dict [ str , Any ]
249
+ self , proxied : Engine , execution_options : _ExecuteOptions
252
250
) -> None : ...
253
251
254
252
class OptionEngine (OptionEngineMixin , Engine ): ...
0 commit comments