Skip to content
rbarooah edited this page Sep 13, 2010 · 14 revisions

SimpleDB binding for Scala

A lightweight and easy to use interface to Amazon’s SimpleDB web service, designed to complement Scala’s expressiveness.

Some examples

import org.sublime.amazon.simpleDB.api._

Import the API Classes

val account = new SimpleDBAccount( <keyId>, <key> )

Create an account object representing your Amazon AWS account.

import account._

Import the symbols from the account for convenience.

domain ("test") create

Create a domain called ‘test’.

domain ("test") item ("robin") += ("role" -> "author")

Add an attribute called “role” with a value “author” to the item named “robin”.

domain ("test") item ("landon") += ("role" -> "reviewer")

Add an attribute called “role” with a value “reviewer” to the item named “landon”.

select ("select * from test where role='reviewer'") foreach ( e => println(e.name))

Print the names of the items in the ‘test’ domain who’s role is ‘reviewer’.

select ("select * from test where role='reviewer'") foreach ( e => domain ("test") item (e) set ("score" -> "2"))

Set the ‘score’ attribute of every ‘reviewer’ to ‘2’.

Documentation Here: ScalaDocs

(Hint: All of the stuff you need is in the SimpleAPI trait…)

Clone this wiki locally