The QueryWithAttributes operation returns a set of Attributes
for ItemNames that match the query expression. QueryWithAttributes
operations that run longer than 5 seconds will likely time-out and return a time-out error response.
A QueryWithAttributes with no QueryExpression matches
all items in the domain.
![]() | Note |
|---|---|
The current timeout for long queries is 5 seconds. Your application should not excessively retry queries that return For information about limits that affect Query, see Amazon SimpleDB Limits. |
The total size of the response cannot exceed 1 MB in total size. Amazon SimpleDB automatically adjusts the number of items returned per page to enforce this limit. For example, even if you ask to retrieve 250 items, but each individual item is 100 kB in size, the system returns 10 items and an appropriate NextToken to get the next page of results.
For information on how to construct query expressions, see Using Query.
| Name | Description | Required? |
|---|---|---|
DomainName
|
The name of the domain to execute the query against. Type: String | Yes |
AttributeName
|
The name of the attribute to return. To return multiple attributes, you can specify this request parameter multiple times. Type: String Default: None. If this request parameter is not specified or left blank, all attributes are returned. | No |
MaxNumberOfItems
|
Maximum number of ItemNames to return in the response. Type: String The range is 1 to 250. The default setting is 100. | No |
NextToken
|
String that tells Amazon SimpleDB where to start the next list of ItemNames. Type: String | No |
QueryExpression
|
The expression used to query the domain. Type: String | Optional |
| Name | Description |
|---|---|
<Item><Name>... </Name></Item>
| Item names that match the query expression. |
<Attribute><Name>... </Name></Attribute>
| The name of the attribute. |
<Attribute><Value>... </Value></Attribute>
| The value of the attribute. |
| Error | Description |
|---|---|
InvalidParameterValue
|
Value (" + value + ") for parameter MaxNumberOfItems is invalid. MaxNumberOfItems must be between 1 and 250. |
InvalidParameterValue
| Value (" + value + ") for parameter AttributeName is invalid. Value exceeds maximum length of 1024. |
InvalidNextToken
| The specified next token is not valid. |
InvalidNumberPredicates
| Too many predicates in the query expression. |
InvalidNumberValueTests
| Too many value tests per predicate in the query expression. |
InvalidQueryExpression
| The specified query expression syntax is not valid. |
MissingParameter
|
The request must contain the parameter DomainName. |
NoSuchDomain
| The specified domain does not exist. |
RequestTimeout
| A timeout occurred when attempting to query domain <domain name> with query expression <query expression>. BoxUsage [<box usage value>]" |
TooManyRequestedAttributes
| Too many attributes requested. |
https://sdb.amazonaws.com/ ?Action=QueryWithAttributes &AWSAccessKeyId=[valid access key id] &DomainName=MyDomain &MaxNumberOfItems=3 &NextToken=[valid next token] &QueryExpression=%5B%27Color%27%3D%27Blue%27%5D &SignatureVersion=1 &Timestamp=2007-06-25T15%3A03%3A09-07%3A00 &Version=2007-11-07 &Signature=2wVXB1x0NSWWETwLylZPVP%2FtqXQ%3D
<QueryWithAttributesResponse xmlns="http://sdb.amazonaws.com/doc/2007-11-07">
<QueryWithAttributesResult>
<Item>
<Name>Item_03</Name>
<Attribute><Name>Category</Name><Value>Clothes</Value></Attribute>
<Attribute><Name>Subcategory</Name><Value>Pants</Value></Attribute>
<Attribute><Name>Name</Name><Value>Sweatpants</Value></Attribute>
<Attribute><Name>Color</Name><Value>Blue</Value></Attribute>
<Attribute><Name>Color</Name><Value>Yellow</Value></Attribute>
<Attribute><Name>Color</Name><Value>Pink</Value></Attribute>
<Attribute><Name>Size</Name><Value>Large</Value></Attribute>
</Item>
<Item>
<Name>Item_06</Name>
<Attribute><Name>Category</Name><Value>Motorcycle Parts</Value></Attribute>
<Attribute><Name>Subcategory</Name><Value>Bodywork</Value></Attribute>
<Attribute><Name>Name</Name><Value>Fender Eliminator</Value></Attribute>
<Attribute><Name>Color</Name><Value>Blue</Value></Attribute>
<Attribute><Name>Make</Name><Value>Yamaha</Value></Attribute>
<Attribute><Name>Model</Name><Value>R1</Value></Attribute>
</Item>
</QueryWithAttributesResult>
<ResponseMetadata>
<RequestId>b1e8f1f7-42e9-494c-ad09-2674e557526d</RequestId>
<BoxUsage>0.0000219907</BoxUsage>
</ResponseMetadata>
</QueryWithAttributesResponse>
https://sdb.amazonaws.com/ ?Action=QueryWithAttributes &AWSAccessKeyId=[valid access key id] &AttributeName.1=Category &AttributeName.2=Name &AttributeName.3=Make &DomainName=MyDomain &MaxNumberOfItems=3 &NextToken=[valid next token] &QueryExpression=%5B%27Color%27%3D%27Blue%27%5D &SignatureVersion=1 &Timestamp=2007-06-25T15%3A03%3A09-07%3A00 &Version=2007-11-07 &Signature=2wVXB1x0NSWWETwLylZPVP%2FtqXQ%3D
<QueryWithAttributesResponse xmlns="http://sdb.amazonaws.com/doc/2007-11-07">
<QueryWithAttributesResult>
<Item>
<Name>Item_03</Name>
<Attribute><Name>Category</Name><Value>Clothes</Value></Attribute>
<Attribute><Name>Name</Name><Value>Sweatpants</Value></Attribute>
</Item>
<Item>
<Name>Item_06</Name>
<Attribute><Name>Category</Name><Value>Motorcycle Parts</Value></Attribute>
<Attribute><Name>Name</Name><Value>Fender Eliminator</Value></Attribute>
<Attribute><Name>Make</Name><Value>Yamaha</Value></Attribute>
</Item>
</QueryWithAttributesResult>
<ResponseMetadata>
<RequestId>b1e8f1f7-42e9-494c-ad09-2674e557526d</RequestId>
<BoxUsage>0.0000219907</BoxUsage>
</ResponseMetadata>
</QueryWithAttributesResponse>