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
S3: set_metadata does not set metadata remotely in the simplest case. #1007
Comments
Metadata can only be set at the time the object is written to S3 or when it is copied. There really isn't anything boto can do about this. |
Hi Mitch, I don't think that's correct. You can do copy-in-the-cloud from an object to itself, specifying x-amz-copy-source to point to the origin object and x-amz-metadata-directive:REPLACE, and then setting headers (which has the effect of just updating the metadata/headers). For example, running the following command: gsutil -d setmeta -h Content-Type:text/html s3://mfsbucket/abc here's the HTTP that's sent: send: 'PUT /mfsbucket/abc HTTP/1.1\r\nHost: s3.amazonaws.com\r\nAccept-Encoding: identity\r\nContent-Length: 0\r\nx-amz-storage-class: STANDARD\r\nUser-Agent: Boto/2.6.0-dev (darwin) gsutil/3.19_PRE (darwin)\r\nx-amz-copy-source: mfsbucket/abc\r\nDate: Wed, 14 Nov 2012 22:05:27 GMT\r\ncontent-type: text/html\r\nAuthorization: ....=\r\nx-amz-metadata-directive: REPLACE\r\n\r\n' And after running the command, I verified that the Content-Type was indeed updated. (I implemented this command for Google Cloud Storage, but it works for S3 as well.) Mike |
I agree that you can do that but I don't think you should do that every time someone changes a value in the local object, do you? |
Oh, sorry, I didn't realize the context here - acrefoot@ was asking about Mike On Wed, Nov 14, 2012 at 3:17 PM, Mitch Garnaat notifications@github.comwrote:
|
It would be nice, however, to have a I guess some additional documentation would be an easier solution, although |
+1 to @xiongchiamiov |
S3: set_metadata doesn't actually update metadata unless you call one of the set_contents_from_* command.
It will keep it in the key that you have in memory, but if you restart python and get that key again, it won't have that metadata.
The text was updated successfully, but these errors were encountered: