1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

DynamoDBエラー [The provided key element does not match the schema]

Posted at

エラー

LambdaからDynamoDBを呼び出す際、get_item(Key={UniqueId: 'UniqueId'})した時にでたエラー。
内容的にkeyのtypeが違うのかと思っていたらソートキーを指定しないといけなかったよう。。。

[ERROR] ClientError: An error occurred (ValidationException) when calling the GetItem operation: The provided key element does not match the schema

解決法

ソートキーを指定するもしくはDBのソートキーを指定しない。

dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('テーブル')
res = table.get_item(Key={
            'UniqueId': 'UniqueId',
            'SortKey': 'SortKey'
        })
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?