My Photo

« AWS Links - Wednesday, December 17, 2008 | Main | AWS Links - Wednesday, December 23, 2008 »

Amazon SimpleDB - Now With Select

There's now a new and somewhat easier way to write SimpleDB queries.

In addition to SimpleDB's existing query language, you can now use select statements which look very similar to standard SQL (Structured Query Language). We made some small changes and additions to the language in order to accomodate SimpleDB's unique multi-valued attribute model.

Here are some valid select statements:

select * from mydomain where city = 'Seattle'
select * from mydomain where city = 'Seattle' or city = 'Portland'
select * from mydomain where author not like 'Henry%'

Things get even more interesting once multi-valued atttibutes are used. This query returns the items where the only attribute value for keyword is 'Book':

select * from mydomain where every(keyword) = 'Book'

The following query returns items where the only value for keyword is 'Book' or Paperback':

select * from mydomain where every(keyword) in ('Book', 'Paperback')

And the following query returns all the items which have the values 'Book' and 'Hardcover' in keyword:

select * from mydomain where keyword = 'Book' intersection keyword = 'Hardcover'

You can also sort the results on any of the attributes that was used in the expression:

select * from mydomain where Year = '2007' intersection Author is not null order by Author desc

The new SimpleDB Select function accepts queries in this new syntax. The existing Query and QueryWithAttributes functions are still usable, of course. There's full information in the new version of the Developer Guide.

--Jeff;

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341c534853ef0105367cc952970b

Listed below are links to weblogs that reference Amazon SimpleDB - Now With Select:

Comments

There was rumors and anticipation of another company starting a SQL cloud... then POW! Amazon is on the cutting edge of what developers need and this addition of Select API is yet another championship ring for AWS.

MySQL just bothers me in terms of needing to handle big spikes of use of say 1000 simultaneous transactions even with a cluster going. SQS has been solid and now SDB will become an important offering for enterprise users...

Perhaps there is some interest to create a real-time MySQL to SELECT API SDB bridge library- we will look at doing it in 2009 :)

William, I hate to burst your bubble but SQL-like syntax or not, Amazon SimpleDb is very different than a relational database. This change is a very minor part of bridging that yawning gap between their data models. I wish it were true that SimpleDb was just "MySQL without the scale problems" but it is not. There are deep reasons why it is really hard to arbitrarily scale relational databases and therefore why Amazon decided NOT to make SimpleDb a relational database.

Hi Paul, it wont be long before we have INSERT, UPDATE and DELETE.

It only takes a hint to get me excited.

William: I'm not talking about three more method. I'm talking about the WHOLE RELATIONAL DATA MODEL. Primary keys, foreign keys, joins, transactions, constraints, triggers, sub-selects, etc. etc.

Compare the documentation for MySQL to the documentation for SimpleDB. There is almost no intersection. They are not the same kind of thing at all.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Comments are moderated, and will not appear until the author has approved them.

Email Subscription

Enter your email address:

Delivered by FeedBurner

July 2009

Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31