This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Queries in Amazon SimpleDB

The select operation returns a set of attributes for items that match the select expression. The select operation is similar to the standard SQL SELECT statement and is case-sensitive. For further information on how to construct select expressions, see Using Select to Create Amazon SimpleDB Queries.

Amazon SimpleDB keeps multiple copies of each domain. When data is written or updated, all copies of the data are updated. However, it takes time for the update to propagate to all storage locations. The data will eventually be consistent, but an immediate read might not show the change.

 

select
<amazonsdb.select>
	<consistentRead>{$ctx:consistentRead}</consistentRead>
	<nextToken>{$ctx:nextToken}</nextToken>
	<selectExpression>{$ctx:selectExpression}</selectExpression>
</amazonsdb.select>
Properties
  • consistentRead: Optional - When it is set to true, ensures that the most recent data is returned. For more information, see Consistency.
  • nextToken: Optional - String that tells Amazon SimpleDB where to start the next list of item names.
  • selectExpression: Required - The expression used to query the domain.
  • The total size of the response cannot exceed 1 MB. Amazon SimpleDB automatically adjusts the number of items returned per page to enforce this limit. For example, even if you ask to retrieve 2500 items with each individual item being 10 KB in size, the system returns 100 items and an appropriate next token so you can get the next page of results.
  • Operations that run longer than 5 seconds return a time-out error response or a partial or empty result set. Partial and empty result sets contain a nextToken value, which allows you to continue the operation from where it left off.
  • Responses larger than one megabyte return a partial result set.
  • The application should not excessively retry queries that return QueryTimeout errors. If too many QueryTimeout errors are received, reduce the complexity of the query expression.
  • Note that Amazon SimpleDB does not guarantee how attributes are ordered in the returned response.
  • For information about limits that affect select, see Limits.

 

Sample request

Following is a sample REST/XML request that can be handled by the select operation.

Sample Request for select
<root>
	<apiUrl>https://sdb.amazonaws.com/</apiUrl>
	<accessKeyId>AKIAIYMUNCUHsdfQJEFMURA</accessKeyId>
	<secretAccessKey>qAb5n5hAYzpgsdfcD2+7APuEVg3rLtpkkEuTj2zjGOg</secretAccessKey>
	<action>Select</action>
	<version>2009-04-15</version>
	<signatureVersion>2</signatureVersion>
	<signatureMethod>HmacSHA1</signatureMethod>
	<selectExpression>select * from table</selectExpression>
	<consistentRead>true</consistentRead>
</root> 
Related Amazon SimpleDB documentation

http://docs.aws.amazon.com/AmazonSimpleDB/latest/DeveloperGuide/SDB_API_Select.html

Sample configuration

Following is a sample proxy service that illustrates how to connect to Amazon SimpleDB with the init operation and use the select operation. The sample request for this proxy can be found in select sample request.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="amazonSimpleDB_select"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence onError="faultHandlerSeq">	  
		  <property name="apiUrl" expression="//apiUrl/text()"/>
		  <property name="accessKeyId" expression="//accessKeyId/text()"/>
		  <property name="secretAccessKey" expression="//secretAccessKey/text()"/>
		  <property name="action" expression="//action/text()"/>
		  <property name="version" expression="//version/text()"/>
		  <property name="signatureVersion" expression="//signatureVersion/text()"/>
		  <property name="signatureMethod" expression="//signatureMethod/text()"/>
          <property name="selectExpression" expression="//selectExpression/text()"/>
          <property name="nextToken" expression="//nextToken/text()"/>
          <property name="consistentRead" expression="//consistentRead/text()"/>		 
         <amazonsdb.init>
            <signatureMethod>{$ctx:signatureMethod}</signatureMethod>
            <secretAccessKey>{$ctx:secretAccessKey}</secretAccessKey>
            <action>{$ctx:action}</action>
            <accessKeyId>{$ctx:accessKeyId}</accessKeyId>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <signatureVersion>{$ctx:signatureVersion}</signatureVersion>
            <version>{$ctx:version}</version>
         </amazonsdb.init>
         <amazonsdb.select>
            <consistentRead>{$ctx:consistentRead}</consistentRead>
            <nextToken>{$ctx:nextToken}</nextToken>
            <selectExpression>{$ctx:selectExpression}</selectExpression>
         </amazonsdb.select>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
	        <faultSequence>
         <makefault version="soap11">
            <code expression="get-property('ERROR_CODE')"/>
            <reason expression="get-property('ERROR_MESSAGE')"/>
            <detail expression="get-property('ERROR_DETAIL')"/>
         </makefault>
         <send/>
      </faultSequence>
   </target>
   <description/>
</proxy>