-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
difficult to perform delete_object request instead of delete_objects using S3FileSystem #850
Comments
Quick question before going further: if you use GCS, why not use gcsfs? Secondly, |
Thanks for your quick response, @martindurant !
That's something we can consider. My initial thought is that we simultaneously want to support AWS S3, GCS, seaweedfs, and localstack with a single common filesystem abstraction. So far
I might be missing something, but from what I can tell, |
The various implementations of fsspec are designed to be as close to each other as possible. Unfortunately, there can be many optional features, and S3 is particularly guilty of this, since it's not quite a standard, and the permissioning model is complex.
This is the current implementation of _rm_file: async def _rm_file(self, path, **kwargs):
bucket, key, _ = self.split_path(path)
self.invalidate_cache(path)
try:
await self._call_s3("delete_object", Bucket=bucket, Key=key)
except ClientError as e:
raise translate_boto_error(e) and you can see the call to "delete_object". The AsyncFileSystem's |
Thanks for pointing that out. Indeed, the private method Unfortunately, there also doesn't appear to be a public/blocking/synchronous entrypoint for calling def rm_file(self, path):
"""Delete a file"""
self._rm(path) I think my solution suggestion for |
Actually, I can see that imitating |
It does! Sync variants of all the async methods listed in AsyncFileSystem are auto-generated.
|
Fantastic! I didn't realize that it would be sort of auto-generated. Thanks! |
It appears that, while the implementation of
_rm
inAsyncFileSystem
invokes thedelete_object
API, theS3FileSystem
class overrides it with a version that uses thedelete_objects
API. This is usually fine, but since GCS doesn't supportdelete_objects
,S3FileSystem.rm(path)
will fail on GCS.It would be great if
S3FileSystem
provided an option to delete with thedelete_object
API instead of forcing the use ofdelete_objects
.In the meantime, I've had to resort to doing this:
Which allows me to force the use of the
_rm
method on theAsyncFileSystem
(parent class), but doesn't have a blocking/synchronous entrypoint that I could find.The text was updated successfully, but these errors were encountered: