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 2023/06/23 16:45:41 UTC

[iceberg] branch master updated: Python: Log to logging instead of warn (#7876)

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 6b23d2555d Python: Log to logging instead of warn (#7876)
6b23d2555d is described below

commit 6b23d2555d542b83396ce488e253813276d0c25d
Author: Fokko Driesprong <fo...@apache.org>
AuthorDate: Fri Jun 23 18:45:36 2023 +0200

    Python: Log to logging instead of warn (#7876)
    
    * Python: Log to logging instead of warn
    
    I was doing some final testing befor the release, and noticed
    that when you don't have PyArrow installed (only s3fs), and
    you try to describe a table, you'll get a warning:
    
    ```
    root@0d64c149ba01:/vo# pyiceberg describe dbt_tabular.rides
    /vo/pyiceberg/io/__init__.py:283: UserWarning: Could not initialize FileIO: pyiceberg.io.pyarrow.PyArrowFileIO
      warnings.warn(f"Could not initialize FileIO: {io_impl}")
    Table format version  1
    
    Metadata location
    s3://tabular-wh-us-east-1/6efbcaf4-21ae-499d-b340-3bc1a7003f52/f59f662e-878f-42e4-8b66-04b076c8ee23/metadata/00037-c9977e9d-64d7-45fc-a93a-7e10efdfecc9.gz.metadat…
    Table UUID            f59f662e-878f-42e4-8b66-04b076c8ee23
    
    Last Updated          1684818900590
    
    Partition spec        []
    
    Sort order            []
    
    Current schema        Schema, id=13
    
                          ├── 1: vendor: optional string (TPEP provider that provided the record)
    
                          ├── 2: pickup_time: optional timestamptz (The date and time when the meter was engaged.)
    
                          ├── 3: pickup_zone_name: optional string (Taxi Zone in which the taximeter was engaged.)
    
                          ├── 4: pickup_borough: optional string (Borough in which the taximeter was engaged.)
    
                          ├── 5: dropoff_time: optional timestamptz (The date and time when the meter was disengaged.)
    
                          ├── 6: dropoff_zone_name: optional string (Taxi Zone in which the taximeter was disengaged)
    
                          ├── 7: dropoff_borough: optional string (Borough in which the taximeter was disengaged)
    
                          ├── 8: passenger_count: optional int (The number of passengers in the vehicle (This is a driver-entered value).)
    ```
    
    I think it makes more sense to send this to logging so you
    don't see it in the console.
    
    * Oops
---
 python/pyiceberg/io/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/pyiceberg/io/__init__.py b/python/pyiceberg/io/__init__.py
index 27a3996101..2c82d890e4 100644
--- a/python/pyiceberg/io/__init__.py
+++ b/python/pyiceberg/io/__init__.py
@@ -280,7 +280,7 @@ def _import_file_io(io_impl: str, properties: Properties) -> Optional[FileIO]:
         class_ = getattr(module, class_name)
         return class_(properties)
     except ModuleNotFoundError:
-        warnings.warn(f"Could not initialize FileIO: {io_impl}")
+        logger.warning("Could not initialize FileIO: %s", io_impl)
         return None