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' 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':
The following query returns items where the only value for keyword is 'Book' or Paperback':
And the following query returns all the items which have the values 'Book' and 'Hardcover' in keyword:
You can also sort the results on any of the attributes that was used in the expression:
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;
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 :)
Posted by: William Blanchard | December 18, 2008 at 12:13 PM
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.
Posted by: Paul Prescod | December 19, 2008 at 07:56 AM
Hi Paul, it wont be long before we have INSERT, UPDATE and DELETE.
It only takes a hint to get me excited.
Posted by: William Blanchard | December 19, 2008 at 01:31 PM
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.
Posted by: Paul Prescod | December 30, 2008 at 11:57 AM