We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7ffea3c commit da90228Copy full SHA for da90228
sqlglot/dialects/__init__.py
@@ -62,6 +62,7 @@ class Generator(Generator):
62
"""
63
64
import importlib
65
+import threading
66
67
DIALECTS = [
68
"Athena",
@@ -104,11 +105,14 @@ class Generator(Generator):
104
105
106
__all__ = list(MODULE_BY_ATTRIBUTE)
107
108
+_import_lock = threading.Lock()
109
+
110
111
def __getattr__(name):
112
module_name = MODULE_BY_ATTRIBUTE.get(name)
113
if module_name:
- module = importlib.import_module(f"sqlglot.dialects.{module_name}")
114
+ with _import_lock:
115
+ module = importlib.import_module(f"sqlglot.dialects.{module_name}")
116
return getattr(module, name)
117
118
raise AttributeError(f"module {__name__} has no attribute {name}")
0 commit comments