amazon-dynamodb - 如何解决这个异常 : "Cannot specify the AttributesToGet when choosing to get ALL_ATTRIBUTES"?

标签 amazon-dynamodb

当我尝试使用 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/

相关文章:

python - 如何通过流从dynamodb推送数据

java - 使用Java在DynamoDb中找不到QueryRequest的SetCount方法

csv - 如何从 aws 控制台将 dynamoDB 表的整个记录​​导出到 CSV?

hadoop - Hive 在尝试从表中选择时显示 org.apache.hadoop.hive.ql.metadata.HiveException

javascript - 错误: The security token included in the request is invalid - AWS DynamoDB

amazon-web-services - AWS 文档数据库中的事务

java - DynamoDB-Java 如果存在则写入,如果不存在则更新

ruby - 使用 Ruby 删除 DynamoDB 表中的所有项目

amazon-web-services - 属性投影不能为空

amazon-web-services - 如何为巨大的静态 dynamodb 表中的每个项目触发 lambda