|
5 | 5 | import math |
6 | 6 | import sys |
7 | 7 | import logging |
8 | | -from typing import Any, Callable, Dict, Generator, Tuple, Optional, Sequence, Type, List, Union, TypeVar |
| 8 | +from typing import Any, Callable, ClassVar, Dict, Generator, Tuple, Optional, Sequence, Type, List, Union, TypeVar |
9 | 9 | from functools import partial, wraps |
10 | 10 | from concurrent.futures import ThreadPoolExecutor |
11 | 11 | import threading |
@@ -179,6 +179,9 @@ class ThreadLocalInterpreter: |
179 | 179 | Useful for cursor-sensitive operations, such as creating a temporary table. |
180 | 180 | """ |
181 | 181 |
|
| 182 | + compiler: Compiler |
| 183 | + gen: Generator |
| 184 | + |
182 | 185 | def __init__(self, compiler: Compiler, gen: Generator): |
183 | 186 | super().__init__() |
184 | 187 | self.gen = gen |
@@ -238,9 +241,9 @@ def optimizer_hints(self, hints: str) -> str: |
238 | 241 |
|
239 | 242 |
|
240 | 243 | class BaseDialect(abc.ABC): |
241 | | - SUPPORTS_PRIMARY_KEY = False |
242 | | - SUPPORTS_INDEXES = False |
243 | | - TYPE_CLASSES: Dict[str, type] = {} |
| 244 | + SUPPORTS_PRIMARY_KEY: ClassVar[bool] = False |
| 245 | + SUPPORTS_INDEXES: ClassVar[bool] = False |
| 246 | + TYPE_CLASSES: ClassVar[Dict[str, type]] = {} |
244 | 247 |
|
245 | 248 | PLACEHOLDER_TABLE = None # Used for Oracle |
246 | 249 |
|
@@ -835,14 +838,13 @@ class Database(abc.ABC, _RuntypeHackToFixCicularRefrencedDatabase): |
835 | 838 | Instanciated using :meth:`~data_diff.connect` |
836 | 839 | """ |
837 | 840 |
|
838 | | - default_schema: str = None |
839 | | - SUPPORTS_ALPHANUMS = True |
840 | | - SUPPORTS_UNIQUE_CONSTAINT = False |
841 | | - |
842 | | - CONNECT_URI_KWPARAMS = [] |
| 841 | + SUPPORTS_ALPHANUMS: ClassVar[bool] = True |
| 842 | + SUPPORTS_UNIQUE_CONSTAINT: ClassVar[bool] = False |
| 843 | + CONNECT_URI_KWPARAMS: ClassVar[List[str]] = [] |
843 | 844 |
|
844 | | - _interactive = False |
845 | | - is_closed = False |
| 845 | + default_schema: Optional[str] = None |
| 846 | + _interactive: bool = False |
| 847 | + is_closed: bool = False |
846 | 848 |
|
847 | 849 | @property |
848 | 850 | def name(self): |
@@ -1109,6 +1111,10 @@ class ThreadedDatabase(Database): |
1109 | 1111 | Used for database connectors that do not support sharing their connection between different threads. |
1110 | 1112 | """ |
1111 | 1113 |
|
| 1114 | + _init_error: Optional[Exception] |
| 1115 | + _queue: ThreadPoolExecutor |
| 1116 | + thread_local: threading.local |
| 1117 | + |
1112 | 1118 | def __init__(self, thread_count=1): |
1113 | 1119 | super().__init__() |
1114 | 1120 | self._init_error = None |
|
0 commit comments