-
Notifications
You must be signed in to change notification settings - Fork 151
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
Can't delete custom metadata key on object #381
Comments
I was able to reproduce the issue from your example. I think it's expected that deleting a key would not succeed in overwriting the key when using a patch request. However, I would think that at least by setting a key's value to None, it would be possible to indicate that the key should be deleted by sending null to the API. However, this also fails because of this line here: python-storage/google/cloud/storage/blob.py Line 3629 in fdabd6a
None is stored as "None" !
I tested locally and by rewriting the line as follows, we can allow keys to be deleted by setting their value to None:
@frankyn @andrewsg does this seem like the correct approach to you? If so I'll make a PR (and add it to the docs for metadata that this is how keys can be deleted). |
Metadata keys can be cleared in the JSON API by setting the value to null; however this doesn't currently work through this library. This PR allows users to clear metadata keys by setting the value to None and documents how users should do this. Fixes googleapis#381
I'm surprised we hadn't seen this before to be honest, but yes, the suggestion LGTM! |
Metadata keys can be cleared in the JSON API by setting the value to null; however this doesn't currently work through this library. This PR allows users to clear metadata keys by setting the value to None and documents how users should do this. Fixes #381
Metadata keys can be cleared in the JSON API by setting the value to null; however this doesn't currently work through this library. This PR allows users to clear metadata keys by setting the value to None and documents how users should do this. Fixes googleapis#381
Metadata keys can be cleared in the JSON API by setting the value to null; however this doesn't currently work through this library. This PR allows users to clear metadata keys by setting the value to None and documents how users should do this. Fixes googleapis#381
I ran into some issues trying to delete a custom metadata key from a storage object. I expected the following to work, but did not result in the key being deleted:
The Rest API indicated to send a value of JSON null associated with the key to perform a deletion, but that doesn't seem to happen when issuing a blob.patch with a metadata with a key removed.
As a work around, I created a copy of the desired metadata, deleted all of the blob's metadata (which does work), then updated the metadata to be the desired metadata.
The text was updated successfully, but these errors were encountered: