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

Storage: add support for deleting specific blob generations #5781

Closed
sdigit opened this issue Aug 9, 2018 · 2 comments
Closed

Storage: add support for deleting specific blob generations #5781

sdigit opened this issue Aug 9, 2018 · 2 comments
Assignees
Labels
api: storage Issues related to the Cloud Storage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@sdigit
Copy link

sdigit commented Aug 9, 2018

OS: Debian Stretch
Python 3.6.6
google-cloud-storage 1.10.0

In the following scenario, the API will return versioned blobs. However, it is unable to delete a specific version, as the Blob.delete method does not take a generation parameter nor does Bucket.delete_blob.

from google.cloud.storage import Client
client = Client(project='project-name')
bucket = client.get_bucket('foobar')
blobs = bucket.list_blobs(versions=True)

blobs will iterate over all versions, but calling .delete() on any of them will always delete the current version as the delete code does not supply ?generation=<generation> in the request.

This leads to unintentional data loss when trusting blob.delete() to delete that specific blob.

Ideally, blob.delete() would delete the generation corresponding to that blob's .generation property (this would mimic boto's behavior).

@tseaver tseaver added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. api: storage Issues related to the Cloud Storage API. labels Aug 9, 2018
@tseaver
Copy link
Contributor

tseaver commented Aug 9, 2018

See #4490. We do not have support for fetching specific generations / metagenerations of blobs / objects, but have future plans to add that support.

/cc @frankyn

@frankyn
Copy link
Member

frankyn commented Aug 9, 2018

Thanks @tseaver. Marking this in feature support sheet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants