1
1
from datetime import date , datetime , time
2
2
from decimal import Decimal
3
- from typing import Any , Dict , Iterator , List , Optional , Tuple , Union
3
+ from typing import Any , Dict , Iterator , List , Mapping , Optional , Sequence , Tuple , Union
4
+ from uuid import UUID
4
5
5
6
logger : Any
6
7
8
+ # Python types that can be adapted to SQL.
9
+ _SQLType = Union [None , bool , int , float , Decimal , str , bytes , datetime , UUID ]
10
+
7
11
class CursorWrapper :
8
12
cursor : Any = ...
9
13
db : Any = ...
@@ -15,10 +19,10 @@ class CursorWrapper:
15
19
def __exit__ (self , type : None , value : None , traceback : None ) -> None : ...
16
20
def callproc (self , procname : str , params : List [Any ] = ..., kparams : Dict [str , int ] = ...) -> Any : ...
17
21
def execute (
18
- self , sql : str , params : Optional [Union [List [ bool ], List [ datetime ], List [ float ], Tuple ]] = ...
22
+ self , sql : str , params : Optional [Union [Sequence [ _SQLType ], Mapping [ str , _SQLType ] ]] = ...
19
23
) -> Optional [Any ]: ...
20
24
def executemany (
21
- self , sql : str , param_list : Union [Iterator [ Any ], List [ Tuple [ Union [ int , str ]]]]
25
+ self , sql : str , param_list : Sequence [ Optional [ Union [Sequence [ _SQLType ], Mapping [ str , _SQLType ]]]]
22
26
) -> Optional [Any ]: ...
23
27
24
28
class CursorDebugWrapper (CursorWrapper ):
0 commit comments