开发者

Update multiple items in Amazons SimpleDB

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜