Container for the parameters to the Scan operation.
Retrieves one or more items and its attributes by performing a full scan of a table.
Provide a ScanFilter to get more specific results.
Declaration Syntax
C# |
public class ScanRequest : AmazonWebServiceRequest
Members
All Members | Constructors | Methods | Properties | ||
Icon | Member | Description |
---|---|---|
ScanRequest()()()() | Initializes a new instance of the ScanRequest class | |
AttributesToGet |
List of Attribute names. If attribute names are not specified then all attributes will be returned. If some attributes are not found,
they will not appear in the result.
Constraints: | |
Count |
If set to true, Amazon DynamoDB returns a total number of items for the Scan operation, even if the operation has no matching
items for the assigned filter. Do not set Count to true while providing a list of AttributesToGet, otherwise Amazon
DynamoDB returns a validation error.
| |
Equals(Object) | (Inherited from Object.) | |
ExclusiveStartKey |
Primary key of the item from which to continue an earlier scan. An earlier scan might provide this value if that scan operation was
interrupted before scanning the entire table; either because of the result set size or the Limit parameter. The
LastEvaluatedKey can be passed back in a new scan request to continue the operation from that point.
| |
GetHashCode()()()() | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType()()()() | Gets the type of the current instance. (Inherited from Object.) | |
Limit |
The maximum number of items to return. If Amazon DynamoDB hits this limit while scanning the table, it stops the scan and returns the
matching values up to the limit, and a LastEvaluatedKey to apply in a subsequent operation to continue the scan. Also, if the scanned
data set size exceeds 1 MB before Amazon DynamoDB hits this limit, it stops the scan and returns the matching values up to the limit, and a
LastEvaluatedKey to apply in a subsequent operation to continue the scan.
Constraints: | |
ScanFilter |
Evaluates the scan results and returns only the desired values.
| |
TableName |
The name of the table in which you want to scan. Allowed characters are a-z, A-Z, 0-9, _ (underscore), -
(hyphen) and . (period).
Constraints: | |
ToString()()()() | Returns a string that represents the current object. (Inherited from Object.) | |
WithAttributesToGet(array<String>[]()[][]) | Obsolete.
Adds elements to the AttributesToGet collection
| |
WithAttributesToGet(IEnumerable<(Of <<'(String>)>>)) | Obsolete.
Adds elements to the AttributesToGet collection
| |
WithCount(Boolean) | Obsolete.
Sets the Count property
| |
WithExclusiveStartKey(Key) | Obsolete.
Sets the ExclusiveStartKey property
| |
WithLimit(Int32) | Obsolete.
Sets the Limit property
| |
WithScanFilter(array<KeyValuePair<(Of <<'(String, Condition>)>>)>[]()[][]) | Obsolete.
Adds the KeyValuePairs to the ScanFilter dictionary.
| |
WithTableName(String) | Obsolete.
Sets the TableName property
|
Examples
The following example shows how to scan items in a table.
Note: the Scan operation goes through every item in the table
to check if the item matches all the scan conditions. This makes
the Scan operation particularly slow and expensive (in terms of provisioned throughput).
We will now retrieve all items where the Pages attribute is greater
than the numerical value "200" and where the Title attribute contains
the string "Adventures".
CopyScan sample
// Create a client AmazonDynamoDBClient client = new AmazonDynamoDBClient(); // Define scan conditions Dictionary<string, Condition> conditions = new Dictionary<string,Condition>(); // Title attribute should contain the string "Adventures" Condition titleCondition = new Condition(); titleCondition.WithComparisonOperator("CONTAINS"); titleCondition.WithAttributeValueList(new AttributeValue { S = "Adventures"}); conditions["Title"] = titleCondition; // Pages attributes must be greater-than the numeric value "200" Condition pagesCondition = new Condition(); pagesCondition.WithComparisonOperator("GT"); pagesCondition.WithAttributeValueList(new AttributeValue { N = "200"}); conditions["Pages"] = pagesCondition; // Define marker variable Key startKey = null; do { // Create Scan request ScanRequest request = new ScanRequest { TableName = "SampleTable", ExclusiveStartKey = startKey, ScanFilter = conditions }; // Issue request ScanResult result = client.Scan(request).ScanResult; // View all returned items List<Dictionary<string, AttributeValue>> items = result.Items; foreach (Dictionary<string, AttributeValue> item in items) { Console.WriteLine("Item:"); foreach (var keyValuePair in item) { Console.WriteLine("{0} : S={1}, N={2}, SS=[{3}], NS=[{4}]", keyValuePair.Key, keyValuePair.Value.S, keyValuePair.Value.N, string.Join(", ", keyValuePair.Value.SS.ToArray()), string.Join(", ", keyValuePair.Value.SS.ToArray())); } } // Set marker variable startKey = result.LastEvaluatedKey; } while (startKey != null);
Inheritance Hierarchy
Object | ||
AmazonWebServiceRequest | ||
ScanRequest |
See Also