Can you update all items in a domain based on the attribute value without selecting all the matching items an then updating the items one by one?
Say I have a contacts database and I want to update the region field to 'Southwest' for all items with the State attribute "TX".
in MySQL I can use "UPDATE contacts SET region='Southwest' WHERE State='TX', is there开发者_StackOverflow an equally simple command for SimpleDB?
I'm using the AWS SDK for PHP.
Unfortunately I don’t believe you can do a traditional update similar to a RDMS. The two ways I know how to accomplish this would be to use the BatchPutAttributes or the PutAttributes request. Both require you to select the data first and loop through the entities. The difference is BatchPutAttributes will allow you to update multiple entities in a single call vs updating each entity individually. I would review the documentation for both BatchPutAttributes and PutAttributes as each request has different limitations.
Hope this helps and please keep us updated if you found other ways to accomplish a bulk update.
精彩评论