Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

fix: propagate blob.generation in Bucket.delete_blobs - #817

Closed
cojenco wants to merge 3 commits into
googleapis:mainfrom
cojenco:814generation
Closed

fix: propagate blob.generation in Bucket.delete_blobs#817
cojenco wants to merge 3 commits into
googleapis:mainfrom
cojenco:814generation

Conversation

@cojenco

Copy link
Copy Markdown
Contributor

Fixes#814 🦕

@product-auto-labelproduct-auto-labelBot added size: m Pull request size is medium. api: storage Issues related to the googleapis/python-storage API. labels Jun 15, 2022
@cojenco
cojenco marked this pull request as ready for review June 15, 2022 21:19
@cojenco
cojenco requested review from a teamJune 15, 2022 21:19
@cojencocojenco added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jun 23, 2022
if not isinstance(blob_name, str):
blob_name = blob.name
if blob.generation:
generation = blob.generation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still uncertain whether we should change behavior in this way, though I do agree the current behavior is bad. If we do make this change, can we skip the "take the name from the blob and recreate it" runaround and just run delete on the blob objects directly? This seems unnecessarily convoluted.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand your concerns. Unfortunately, with the current setup, it will be difficult to bypass "take the name from the blob...". Reasons being (1) params blobs can be a list of str blob_name OR blob instances, (2) bucket.delete_blob() only takes str blob_name whereas blob.delete() requires a blob instance.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, I'm wondering if adding a flag to the method will better ensure backwards compatibility, but I'm also concerned that it will make this even more convoluted >"<

@cojenco

Copy link
Copy Markdown
ContributorAuthor

superseded by #840

@cojencocojenco closed this Aug 11, 2022
@cojenco
cojenco deleted the 814generation branch November 16, 2023 22:07
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: storageIssues related to the googleapis/python-storage API.do not mergeIndicates a pull request not ready for merge, due to either quality or timing.size: mPull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bucket.delete_blobs drops 'generation'

3 participants

@cojenco@andrewsg@frankyn