If anyone is interested, my solution was: > (dynamo-client/update-item cred
:table-name "atomic-counter" :key "counter" :attributeUpdates {:count {:value 1 :action "ADD"}}) {:consumed-capacity-units 1.0} > (dynamo-client/get-item cred :table-name "atomic-counter" :key "counter") {:item {:count "1", :id "counter"}, :consumed-capacity-units 0.5} On Wednesday, September 17, 2014 6:44:04 PM UTC-7, ma...@datasnap.io wrote: > > Has anyone used Amazonica <https://github.com/mcohen01/amazonica> to > implement an atomic counter > <http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.AtomicCounters> > > in DynamoDB? > > I plan on having a Dynamo table with only one entry, something that looks > like {"id": "counter", "count": 28734}, where the count acts as an atomic > counter. Then use the update-item function to increment the count, > regardless of it's value. > > I'm struggling to formulate the correct amazonica.aws.dynamodb/update-item > function call. > > I have something like this currently: > > > (dynamo-client/put-item cred > > :table-name "atomic-counter" > > :item {:id "counter" :count 0}) > > {:consumed-capacity-units 1.0} > > > (dynamo-client/get-item cred > > :table-name "atomic-counter" > > :key "counter") > > {:item {:count "0", :id "counter"}, :consumed-capacity-units 0.5 > > > (dynamo-client/update-item cred > > :table-name "atomic-counter" > > :key "counter" > > :attributeUpdates {:count "add"}) > > UnsupportedOperationException nth not supported on this type: Character > clojure.lang.RT.nthFrom (RT.java:857) > > > I've tried a few other variations on the value for attributeUpdates.count. > > Any help would be greatly appreciated! > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.