gpt4 book ai didi

amazon-dynamodb - DynamoDB get_item "The provided key element does not match the schema"

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

我正在尝试使用 https://github.com/aws/aws-sdk-ruby/blob/0465bfacbf87e6bc78c38191961ed860413d85cd/gems/aws-sdk-dynamodb/lib/aws-sdk-dynamodb/table.rb#L697 实现 DynamoDB get_item 调用通过我们的 Ruby on Rails 应用程序,dr-recommends .

通过查看我编写的 DynamoDB CloudFormation 堆栈,我预计以下 get_item 调用能够正常工作,因此我对如何继续感到有点迷茫。

Type: 'AWS::DynamoDB::Table'
Properties:
AttributeDefinitions:
- AttributeName: 'pk'
AttributeType: 'S'
- AttributeName: 'sk'
AttributeType: 'S'
KeySchema:
- KeyType: 'HASH'
AttributeName: 'pk'
- KeyType: 'RANGE'
AttributeName: 'sk'
BillingMode: 'PAY_PER_REQUEST'

您是否在这里看到任何可以解释为什么以下调用可能不起作用的内容?

aws dynamodb get-item --table-name actual-table-name --key "{\"pk\":{\"S\":\"77119f89-d5bc-4662-91bb-f3e81e1d9b21\"}}" --projection-expression sk
# An error occurred (ValidationException) when calling the GetItem operation: The provided key element does not match the schema

最佳答案

GetItem() 要求您使用主键。

您需要指定散列(也称为分区)和排序键。

关于amazon-dynamodb - DynamoDB get_item "The provided key element does not match the schema",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67908480/

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