gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 20:30:47 30 4
gpt4 key购买 nike

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

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com