Support for BatchPutAttributes

4 views
Skip to first unread message

Robin Barooah

unread,
Apr 7, 2009, 5:56:04 PM4/7/09
to Sublime SimpleDB
Hi,

Amazon released support for a new operation called BatchPutAttributes
a few days ago.

This allows you to atomically update multiple attributes on a group of
up to 25 items within a single domain using one request.

The operation succeeds or fails as a whole, however the changes are
not guaranteed to propagate as a whole, so readers may see parts of
the update but not others if they read soon after the operation.

For those not watching the commits, the library in the repository (but
NOT the binary jar) now has support for this operation.

Domain can now be applied to one or more lists of AttributeOperation.
The various different types that refer to items now have a 'batch'
member which is a constructor for AttributeOperation's.

As usual, items do not have to exist before operations can be
performed on them.

Here's an example showing it in action:

val account = Test.account
val users = account domain("users")
import users._

val admin = attribute("admin")
val irritant = attribute("irritant")
val folly = attribute("folly", PositiveInt)
val banned = attribute("banned")

users (item("robin").batch += (admin("true"), irritant("spammer")),
item("spammer").batch set (banned("true"), folly(23)))
Reply all
Reply to author
Forward
0 new messages