kevinjqliu opened a new pull request, #2867:
URL: https://github.com/apache/iceberg-python/pull/2867
<!--
Thanks for opening a pull request!
-->
<!-- In the case this PR will resolve an issue, please replace
${GITHUB_ISSUE_ID} below with the actual Github issue id. -->
<!-- Closes #${GITHUB_ISSUE_ID} -->
# Rationale for this change
Move exception info from warning to debug level in import error handlers.
This provides cleaner user-facing output by default while still making detailed
exception info available for troubleshooting via debug logging.
Changes:
- FileIO import failures (pyiceberg.io.__init__)
- LocationProvider import failures (pyiceberg.table.locations)
- Catalog import failures (pyiceberg.catalog.__init__)
- File deletion failures (pyiceberg.catalog.__init__)
Users now see clean one-line warnings instead of full tracebacks. Developers
can enable debug logging to see detailed exception info.
## Are these changes tested?
## Are there any user-facing changes?
<!-- In the case of user-facing changes, please add the changelog label. -->
#### Before
```
Could not initialize FileIO: pyiceberg.io.pyarrow.PyArrowFileIO
Traceback (most recent call last):
File "/Users/kevinliu/repos/iceberg-python/pyiceberg/io/__init__.py", line
321, in _import_file_io
module = importlib.import_module(module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/Users/kevinliu/.pyenv/versions/3.12.11/lib/python3.12/importlib/__init__.py",
line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 999, in exec_module
File "<frozen importlib._bootstrap>", line 488, in
_call_with_frames_removed
File "/Users/kevinliu/repos/iceberg-python/pyiceberg/io/pyarrow.py", line
54, in <module>
import pyarrow as pa
ModuleNotFoundError: No module named 'pyarrow'
```
#### After
```
Could not initialize FileIO: pyiceberg.io.pyarrow.PyArrowFileIO
```
--
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]