When I'm trying to scan a dynamoDb table and return specific columns using the following example code from AWS page:
string tableName = "Thread";
Table ThreadTable = Table.LoadTable(client, tableName);
ScanFilter scanFilter = new ScanFilter();
scanFilter.AddCondition("ForumId", ScanOperator.Equal, forumId);
scanFilter.AddCondition("Tags", ScanOperator.Contains, "sortkey");
ScanOperationConfig config = new ScanOperationConfig()
{
AttributesToGet = new List<string> { "Subject", "Message" } ,
Filter = scanFilter
};
Search search = ThreadTable.Scan(config);
I'm getting the following exception:
Message: Amazon.DynamoDBv2.AmazonDynamoDBException : Cannot specify the AttributesToGet when choosing to get ALL_ATTRIBUTES ---- Amazon.Runtime.Internal.HttpErrorResponseException : Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
How do I solve it?
I had to add:
Select = SelectValues.SpecificAttributes
to ScanOperationConfig
like this:
ScanOperationConfig config = new ScanOperationConfig
{
AttributesToGet = new List<string> { "Subject", "Message" } ,
Filter = scanFilter
Select = SelectValues.SpecificAttributes
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With