Skip to content

Commit da727bd

Browse files
committed
Fix errors import to avoid circular dependency
1 parent 5516fdc commit da727bd

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

DESCRIPTION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Source code is also available at: https://github.com/snowflakedb/snowflake-conne
1111
- Bumped numpy dependency from <2.1.0 to <=2.2.4
1212
- Added Windows support for Python 3.13.
1313
- Add `bulk_upload_chunks` parameter to `write_pandas` function. Setting this parameter to True changes the behaviour of write_pandas function to first write all the data chunks to the local disk and then perform the wildcard upload of the chunks folder to the stage. In default behaviour the chunks are being saved, uploaded and deleted one by one.
14-
- Implemented lazy import for pandas to improve module loading performance.
14+
- Implemented lazy import for pandas to improve loading performance.
1515

1616

1717
- v3.15.1(May 20, 2025)

src/snowflake/connector/options.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class MissingOptionalDependency:
3232

3333
def __getattr__(self, item):
3434
from . import errors
35+
3536
raise errors.MissingDependencyError(self._dep_name)
3637

3738

@@ -139,13 +140,6 @@ def _import_or_missing_keyring_option() -> tuple[ModuleLikeObject, bool]:
139140

140141

141142
# Create actual constants to be imported from this file
142-
try:
143-
pyarrow = importlib.import_module("pyarrow")
144-
except ImportError:
145-
# Defer errors import to avoid circular dependency
146-
from . import errors
147-
raise errors.MissingDependencyError("pyarrow")
148-
149143
keyring, installed_keyring = _import_or_missing_keyring_option()
150144

151145

@@ -156,6 +150,14 @@ def __getattr__(name):
156150
except ImportError:
157151
return MissingPandas()
158152

153+
elif name == "pyarrow":
154+
try:
155+
return importlib.import_module("pyarrow")
156+
except ImportError:
157+
from . import errors
158+
159+
raise errors.MissingDependencyError("pyarrow")
160+
159161
elif name == "installed_pandas":
160162
return installed_pandas()
161163

0 commit comments

Comments
 (0)