I'd like to add a new item to an Amazon SimpleDB domain only if there isn't already another item with the same item name.
I know how to do it for an attribute. But I want the item name to be checked to make sure it's unique, and it won't overwrite an existing item – without an additional select query, of course.
Example for checking an attribute:
https://sdb.amazonaws.com/
?Action=PutAttributes
&DomainName=MyDomain
&ItemName=JumboFez
&Attribute.1.Name=quantity
&Attribute.1.Value=14
&Attribute.1.Replace=true
&Expected.1.Name=quantity
&Expected.1.Exists=false
&AWSAccessKeyId=[valid access key id]
[...]
According to the FAQ this should be possible:
“These semantics can also be used to implement functionality such as counters, inserting an item only if it does not already exist […]”
You can generate the item name based on the current timestamp. And use like % method to fetch the result.