Skip to content

Commit e1a8e29

Browse files
committed
Defer errors import to avoid circular dependency
1 parent 2a61a37 commit e1a8e29

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/snowflake/connector/options.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
from packaging.requirements import Requirement
1212

13-
from . import errors
14-
1513
logger = getLogger(__name__)
1614

1715
"""This module helps to manage optional dependencies.
@@ -33,6 +31,7 @@ class MissingOptionalDependency:
3331
_dep_name = "not set"
3432

3533
def __getattr__(self, item):
34+
from . import errors
3635
raise errors.MissingDependencyError(self._dep_name)
3736

3837

@@ -143,6 +142,8 @@ def _import_or_missing_keyring_option() -> tuple[ModuleLikeObject, bool]:
143142
try:
144143
pyarrow = importlib.import_module("pyarrow")
145144
except ImportError:
145+
# Defer errors import to avoid circular dependency
146+
from . import errors
146147
raise errors.MissingDependencyError("pyarrow")
147148

148149
keyring, installed_keyring = _import_or_missing_keyring_option()

0 commit comments

Comments
 (0)