Skip to content
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

Possibility to extend GCS Blob/ BlobStats to also contain metadata? #100

Open
cwerner opened this issue Jan 24, 2023 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@cwerner
Copy link

cwerner commented Jan 24, 2023

Hi 👋

I just discovered your lib and as a big fan of pathlib I'm thrilled! I have one question though. GCS blobs have a metadata field that can contain arbitrary key/ value pairs (see https://cloud.google.com/storage/docs/viewing-editing-metadata#edit). I use them to label content in buckets and easily filter on these labels (i.e.flag invalid data, subsequent removal of all invalid data etc.)...
I thought about modifying the Blob, BlobStats classes, but maybe this feature would be useful enough to be included in the lib? If not: what would be the easiest way to achieve this?

Cheers,
C

@justindujardin
Copy link
Owner

justindujardin commented Jan 11, 2024

This would be a nice addition. It looks like all our providers support setting metadata on blobs:

Client Docs
GCS https://cloud.google.com/storage/docs/viewing-editing-metadata#edit
S3 https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingMetadata.html
Azure https://learn.microsoft.com/en-us/rest/api/storageservices/set-blob-metadata?tabs=microsoft-entra-id

The only snag I see is the local-only developer mode, where we must write to the filesystem. I don't think Windows provides a way to set metadata on files directly, so we'd need to store it as sibling hidden files, or something similar.

what would be the easiest way to achieve this?

First you'd want to extend pathy with a new method similar to the ls method. Then you'd add the new method/s to BucketClient and update the gcs.py, s3.py and azure.py to implement the appropriate calls and methods.

@justindujardin justindujardin added the enhancement New feature or request label Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants