You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by fo...@apache.org on 2022/09/07 10:27:11 UTC

[iceberg] branch master updated: Python:Fix FileIO fallback to pyarrow when s3fs not present. (#5717)

This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new c0f175b517 Python:Fix FileIO fallback to pyarrow when s3fs not present. (#5717)
c0f175b517 is described below

commit c0f175b517edef5dd1b06a5ac7890fb35224bc25
Author: Joshua Robinson <33...@users.noreply.github.com>
AuthorDate: Wed Sep 7 12:27:03 2022 +0200

    Python:Fix FileIO fallback to pyarrow when s3fs not present. (#5717)
---
 python/pyiceberg/io/__init__.py | 4 ++--
 python/pyiceberg/io/fsspec.py   | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/python/pyiceberg/io/__init__.py b/python/pyiceberg/io/__init__.py
index d40d486b06..16955c2b23 100644
--- a/python/pyiceberg/io/__init__.py
+++ b/python/pyiceberg/io/__init__.py
@@ -262,8 +262,8 @@ def _import_file_io(io_impl: str, properties: Properties) -> Optional[FileIO]:
         module = importlib.import_module(module_name)
         class_ = getattr(module, class_name)
         return class_(properties)
-    except ImportError:
-        logger.exception("Could not initialize FileIO: %s", io_impl)
+    except ModuleNotFoundError:
+        logger.warning("Could not initialize FileIO: %s", io_impl)
         return None
 
 
diff --git a/python/pyiceberg/io/fsspec.py b/python/pyiceberg/io/fsspec.py
index d9bb21b64e..20d972b967 100644
--- a/python/pyiceberg/io/fsspec.py
+++ b/python/pyiceberg/io/fsspec.py
@@ -21,14 +21,13 @@ from typing import Callable, Union
 from urllib.parse import urlparse
 
 from fsspec import AbstractFileSystem
+from s3fs import S3FileSystem
 
 from pyiceberg.io import FileIO, InputFile, OutputFile
 from pyiceberg.typedef import Properties
 
 
 def _s3(properties: Properties) -> AbstractFileSystem:
-    from s3fs import S3FileSystem
-
     client_kwargs = {
         "endpoint_url": properties.get("s3.endpoint"),
         "aws_access_key_id": properties.get("s3.access-key-id"),