This is the table partition key setting
When I tried to get an item from the table, it prints this error
botocore.exceptions.ClientError: An error occurred
(ValidationException) when calling the GetItem operation: The provided
key element does not match the schema
This is my code
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('testDynamodb')
response = table.get_item(Key={'userId': "user2873"})
item = response['Item']
print(item)
Any ideas? thanks.
Rohit Patel
Your table schema has both hash key and sort key defined. When using DynamoDB GetItem you must provide both of them, here is an excerpt from documentation
So given your example, here is how get_item parameters should look like: