Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Amazon SimpleDB Developer Guide

You're reading from  Amazon SimpleDB Developer Guide

Product type Book
Published in Jun 2010
Publisher Packt
ISBN-13 9781847197344
Pages 252 pages
Edition 1st Edition
Languages
Toc

Table of Contents (16) Chapters close

Amazon SimpleDB Developer Guide
Credits
Foreword
About the Authors
About the Reviewers
1. Preface
1. Getting to Know SimpleDB 2. Getting Started with SimpleDB 3. SimpleDB versus RDBMS 4. The SimpleDB Data Model 5. Data Types 6. Querying 7. Storing Data on S3 8. Tuning and Usage Costs 9. Caching 10. Parallel Processing

Querying for multi-valued attributes


Retrieve all songs with a rating of 4 stars or ****:

SELECT * FROM songs WHERE Rating = '****' OR Rating = '4 stars'

To retrieve all songs with a rating of '4 stars' and '****' use:

SELECT * FROM songs WHERE Rating = '****' INTERSECTION Rating = '4 stars'

While it may seem logical to use AND, it is not syntactically acceptable to SimpleDB.

getAttribute

SELECT is the most common technique to retrieve items from SimpleDB, but one special case is retrieving one item using the item name. This can be done with a SELECT query, but getAttributes uses about 41% of the box usage of the SELECT query.

getAttributes in Java

In this example, we will retrieve the attributes for an item from SimpleDB. Typica provides a method called getItemsAttributes(), which uses getAttributes under the covers.

SimpleDB sdb = new SimpleDB(awsAccessId, awsSecretKey, true);
try {
Domain domain = sdb.getDomain("songs");
List<String> itemsToGet = new ArrayList<String>();
itemsToGet...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}