diff --git a/docs/filesystem.md b/docs/filesystem.md index a4e279500..307f4852b 100644 --- a/docs/filesystem.md +++ b/docs/filesystem.md @@ -399,8 +399,10 @@ operation sends one request (one per page for the iterators and described below, send several, and `generate_presigned_url()` signs a URL locally without a request. The requests are sent with the retry policy. An operation raises `FileNotFoundError` for a missing bucket or multipart upload, or for a missing object or -version that it reads, and caches nothing. Requests sent through `fs.core` do not -invalidate the filesystem's cache: call +version that it reads, and caches nothing. `copy_object()` and `upload_part_copy()` with +a source version that is a delete marker raise `OSError` with `EINVAL`, while the +filesystem's `cp_file()` raises `FileNotFoundError` for it, as for a missing file. +Requests sent through `fs.core` do not invalidate the filesystem's cache: call `fs.invalidate_cache()` after a change, or make it through the filesystem. ```python diff --git a/pyathena/filesystem/s3_core.py b/pyathena/filesystem/s3_core.py index 84b98d94b..802326eea 100644 --- a/pyathena/filesystem/s3_core.py +++ b/pyathena/filesystem/s3_core.py @@ -501,7 +501,9 @@ class S3Core: :class:`~pyathena.filesystem.s3_errors.S3ClientError`): a missing bucket or multipart upload, or a missing object or version that an operation reads, raises ``FileNotFoundError``, and a denied request - ``PermissionError``. + ``PermissionError``. :meth:`copy_object` and :meth:`upload_part_copy` + with a source version that is a delete marker raise ``OSError`` with + ``EINVAL``. As in S3, deleting a missing key is not an error. Nothing is cached. Example: @@ -1019,6 +1021,10 @@ def upload_part_copy( Raises: ValueError: If the upload has no bucket, key, or upload ID, or the source has no key. + FileNotFoundError: If the upload, or the source object or version, + does not exist. + OSError: With ``EINVAL`` for an invalid request, such as a source + version that is a delete marker. """ request = self._multipart_upload_request(upload) if not source.key: @@ -1176,6 +1182,10 @@ def copy_object(self, source: S3Path, destination: S3Path, **params) -> None: Raises: ValueError: If the source or the destination has no key, or the destination has a version ID, which a write cannot replace. + FileNotFoundError: If a bucket, or the source object or version, + does not exist. + OSError: With ``EINVAL`` for an invalid request, such as a source + version that is a delete marker. """ if not source.key: raise ValueError(f"The source has no key: {source.uri}.")