|
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 | MIXINS = frozenset()
|
245 | 248 |
|
246 | 249 | PLACEHOLDER_TABLE = None # Used for Oracle
|
@@ -847,14 +850,13 @@ class Database(abc.ABC, _RuntypeHackToFixCicularRefrencedDatabase):
|
847 | 850 | Instanciated using :meth:`~data_diff.connect`
|
848 | 851 | """
|
849 | 852 |
|
850 |
| - default_schema: str = None |
851 |
| - SUPPORTS_ALPHANUMS = True |
852 |
| - SUPPORTS_UNIQUE_CONSTAINT = False |
853 |
| - |
854 |
| - CONNECT_URI_KWPARAMS = [] |
| 853 | + default_schema: ClassVar[str] = None |
| 854 | + SUPPORTS_ALPHANUMS: ClassVar[bool] = True |
| 855 | + SUPPORTS_UNIQUE_CONSTAINT: ClassVar[bool] = False |
| 856 | + CONNECT_URI_KWPARAMS: ClassVar[List[str]] = [] |
855 | 857 |
|
856 |
| - _interactive = False |
857 |
| - is_closed = False |
| 858 | + _interactive: bool = False |
| 859 | + is_closed: bool = False |
858 | 860 |
|
859 | 861 | @property
|
860 | 862 | def name(self):
|
@@ -1121,6 +1123,10 @@ class ThreadedDatabase(Database):
|
1121 | 1123 | Used for database connectors that do not support sharing their connection between different threads.
|
1122 | 1124 | """
|
1123 | 1125 |
|
| 1126 | + _init_error: Optional[Exception] |
| 1127 | + _queue: ThreadPoolExecutor |
| 1128 | + thread_local: threading.local |
| 1129 | + |
1124 | 1130 | def __init__(self, thread_count=1):
|
1125 | 1131 | super().__init__()
|
1126 | 1132 | self._init_error = None
|
|
0 commit comments