Skip to content

Commit 83f73a7

Browse files
sfc-gh-nqisfc-gh-mmishchenko
authored andcommitted
Update result_set
1 parent 8081d2c commit 83f73a7

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/snowflake/connector/options.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,11 @@ def _import_or_missing_pandas_option() -> (
116116

117117
def installed_pandas() -> bool:
118118
"""This function checks if pandas is available and compatible."""
119-
_, _, installed = _import_or_missing_pandas_option()
120-
return installed
119+
try:
120+
importlib.import_module("pandas")
121+
return True
122+
except ImportError:
123+
return False
121124

122125

123126
def _import_or_missing_keyring_option() -> tuple[ModuleLikeObject, bool]:

src/snowflake/connector/result_set.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
from .constants import IterUnit
2020
from .errors import NotSupportedError
21-
from .options import pandas
2221
from .options import pyarrow as pa
2322
from .result_batch import (
2423
ArrowResultBatch,
@@ -215,6 +214,8 @@ def _fetch_pandas_batches(self, **kwargs) -> Iterator[DataFrame]:
215214

216215
def _fetch_pandas_all(self, **kwargs) -> DataFrame:
217216
"""Fetches a single Pandas dataframe."""
217+
from .options import pandas
218+
218219
concat_args = list(inspect.signature(pandas.concat).parameters)
219220
concat_kwargs = {k: kwargs.pop(k) for k in dict(kwargs) if k in concat_args}
220221
dataframes = list(self._fetch_pandas_batches(is_fetch_all=True, **kwargs))

0 commit comments

Comments
 (0)