11from typing import Any
2- from typing import Dict
32from typing import List
43from typing import MutableMapping
54from typing import Optional
@@ -18,7 +17,8 @@ from .interfaces import ExceptionContext
1817from .interfaces import ExecutionContext
1918from .url import URL
2019from .. import log
21- from .. import util
20+ from .._typing import _ExecuteOptions
21+ from .._typing import _ExecuteParams
2222from ..exc import StatementError
2323from ..pool import Pool
2424
@@ -29,8 +29,6 @@ _TConnection = TypeVar("_TConnection", bound=Connection)
2929_TTransaction = TypeVar ("_TTransaction" , bound = Transaction )
3030_TEngine = TypeVar ("_TEngine" , bound = Engine )
3131
32- _ExecutionOptions : util .immutabledict [Any , Any ]
33-
3432class _ConnectionCallable (Protocol [_T_contra , _T_co ]):
3533 def __call__ (
3634 self , __connection : _T_contra , * args : Any , ** kwargs : Any
@@ -55,15 +53,15 @@ class Connection(_ConnectionTypingCommon, Connectable):
5553 connection : Optional [_DBAPIConnection ] = ...,
5654 close_with_result : bool = ...,
5755 _branch_from : Optional [Any ] = ...,
58- _execution_options : Optional [Dict [ str , Any ] ] = ...,
56+ _execution_options : Optional [_ExecuteOptions ] = ...,
5957 _dispatch : Optional [Any ] = ...,
6058 _has_events : Optional [Any ] = ...,
6159 ) -> None : ...
6260 def schema_for_object (self , obj : Any ) -> str : ...
6361 def __enter__ (self : _TConnection ) -> _TConnection : ...
6462 def __exit__ (self , type_ : Any , value : Any , traceback : Any ) -> None : ...
6563 def execution_options (self : _TConnection , ** opt : Any ) -> _TConnection : ...
66- def get_execution_options (self ) -> Dict [ str , Any ] : ...
64+ def get_execution_options (self ) -> _ExecuteOptions : ...
6765 @property
6866 def connection (self ) -> _DBAPIConnection : ...
6967 def get_isolation_level (self ) -> Any : ...
@@ -92,8 +90,8 @@ class Connection(_ConnectionTypingCommon, Connectable):
9290 def exec_driver_sql (
9391 self ,
9492 statement : str ,
95- parameters : Optional [Any ] = ...,
96- execution_options : Optional [Any ] = ...,
93+ parameters : Optional [_ExecuteParams ] = ...,
94+ execution_options : Optional [_ExecuteOptions ] = ...,
9795 ) -> CursorResult : ...
9896 def transaction (
9997 self : _TConnection ,
@@ -176,7 +174,7 @@ class _EngineTypingCommon:
176174 def driver (self ) -> str : ...
177175 def clear_compiled_cache (self ) -> None : ...
178176 def update_execution_options (self , ** opt : Any ) -> None : ...
179- def get_execution_options (self ) -> Dict [ str , Any ] : ...
177+ def get_execution_options (self ) -> _ExecuteOptions : ...
180178
181179class Engine (_EngineTypingCommon , Connectable , log .Identified ):
182180 @property
@@ -190,7 +188,7 @@ class Engine(_EngineTypingCommon, Connectable, log.Identified):
190188 logging_name : Optional [str ] = ...,
191189 echo : Optional [Union [bool , Literal ["debug" ]]] = ...,
192190 query_cache_size : int = ...,
193- execution_options : Optional [Dict [ str , Any ] ] = ...,
191+ execution_options : Optional [_ExecuteOptions ] = ...,
194192 hide_parameters : bool = ...,
195193 ) -> None : ...
196194 def execution_options (self , ** opt : Any ) -> OptionEngine : ...
@@ -248,7 +246,7 @@ class OptionEngineMixin:
248246 dispatch : Any = ...
249247 pool : Pool = ...
250248 def __init__ (
251- self , proxied : Engine , execution_options : Dict [ str , Any ]
249+ self , proxied : Engine , execution_options : _ExecuteOptions
252250 ) -> None : ...
253251
254252class OptionEngine (OptionEngineMixin , Engine ): ...
0 commit comments