GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||
GeezerVison is showing github.com — Blob.metadata not preserved when uploading new file content · Issue #293 · googleapis/python-storage
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Blob.metadata not preserved when uploading new file content #293Copy link Copy link Closed Labels api: storageIssues related to the googleapis/python-storage API.type: questionRequest for information or clarification. Not an issue. Description
I suspect this bug / surprising behaviour is the result of the somewhat awkward mapping of the REST API onto mutable objects. It feels like setting metadata should really be a parameter of the blob upload methods instead of a mutable field on the instance. Environment details
Both locally on my Mac and within Google Cloud Functions
Python 3.8.5
pip 20.1.1
google-cloud-storage==1.31.2 Steps to reproduceSee code example. Code example>>> b = bucket.blob('testme1') >>> b.metadata = {'test': 'me'} >>> b.upload_from_string('foo') >>> b.metadata {'test': 'me'} >>> b.upload_from_string('bar') >>> b.metadata >>> # Note how b.metadata is not blank >>> b = bucket.blob('testme2') >>> b.metadata = {'test': 'me'} >>> b.upload_from_string('foo') >>> b.metadata {'test': 'me'} >>> b.metadata = b.metadata # <-- workaround >>> b.upload_from_string('bar') >>> b.metadata {'test': 'me'} >>> # Note how b.metadata is now preserved Activity
MetadataMetadataAssigneesLabelsapi: storageIssues related to the googleapis/python-storage API.type: questionRequest for information or clarification. Not an issue. TypeProjectsMilestoneRelationshipsDevelopmentIssue actions | ||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |