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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]