HyunWooZZ commented on issue #1952:
URL: 
https://github.com/apache/iceberg-python/issues/1952#issuecomment-2847423297

   I added some PyIceberg code that retrieves file information from the Arrow 
file system to make it easier for you to find.
   
   
[iceberg-python.pyiceberg.io.pyarrow.py](https://github.com/apache/iceberg-python/blob/main/pyiceberg/io/pyarrow.py#L262)
   
   
   ``` python
   
   
       def _file_info(self) -> FileInfo:
           """Retrieve a pyarrow.fs.FileInfo object for the location.
   
           Raises:
               PermissionError: If the file at self.location cannot be accessed 
due to a permission error such as
                   an AWS error code 15.
           """
           try:
               file_info = self._filesystem.get_file_info(self._path)
           except OSError as e:
               if e.errno == 13 or "AWS Error [code 15]" in str(e):
                   raise PermissionError(f"Cannot get file info, access denied: 
{self.location}") from e
               raise  # pragma: no cover - If some other kind of OSError, raise 
the raw error
   
           if file_info.type == FileType.NotFound:
               raise FileNotFoundError(f"Cannot get file info, file not found: 
{self.location}")
           return file_info
   
   
   ```


-- 
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-unsubscr...@iceberg.apache.org

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


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

Reply via email to