当我尝试使用 AWS 页面中的以下示例代码扫描 dynamoDb 表并返回特定列时:
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);
我收到以下异常:
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.
我该如何解决?
最佳答案
我不得不补充:
Select = SelectValues.SpecificAttributes
到 ScanOperationConfig
像这样:
ScanOperationConfig config = new ScanOperationConfig
{
AttributesToGet = new List<string> { "Subject", "Message" } ,
Filter = scanFilter
Select = SelectValues.SpecificAttributes
};
关于amazon-dynamodb - 如何解决这个异常 : "Cannot specify the AttributesToGet when choosing to get ALL_ATTRIBUTES"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48077307/