You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "Fokko (via GitHub)" <gi...@apache.org> on 2023/03/06 07:46:34 UTC

[GitHub] [iceberg] Fokko commented on a diff in pull request #6844: Python: Don't warn on an identifier

Fokko commented on code in PR #6844:
URL: https://github.com/apache/iceberg/pull/6844#discussion_r1126043355


##########
python/pyiceberg/io/__init__.py:
##########
@@ -275,21 +276,22 @@ def _import_file_io(io_impl: str, properties: Properties) -> Optional[FileIO]:
         class_ = getattr(module, class_name)
         return class_(properties)
     except ModuleNotFoundError:
-        logger.warning("Could not initialize FileIO: %s", io_impl)
+        warnings.warn(f"Could not initialize FileIO: {io_impl}")

Review Comment:
   I think this is a good answer on SO: https://stackoverflow.com/a/37979724/366738
   
   So we first go through the checks to make sure that we extract the scheme so we don't throw a `warning` by accident (as we did prior to this PR). When importing, we notify the users when it cannot be imported because it isn't installed. This can be fixed for the client to be specific about the FileIO by setting the `py-io-imp` property. I prefer to use the `warnings.warn` because you can also let your application crash on this (and then you either set the property or install the missing package, and everything is fine).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org