I'm using Lambda, API-gateway & Dynamodb using python 3.6 I have a dynamodb table for order id:
- orderId (primary Key|String)
- orderStatus (String)
- orderCode (String)
- date (String)
OrderId is unique. Whenever I try to query by date I get the following error:
{
"errorMessage": "An error occurred (ValidationException) when calling the GetItem operation: The provided key element does not match the schema",
"errorType": "ClientError",
"stackTrace": [
[
"/var/task/lambda_function.py",
8,
"lambda_handler",
"\"date\":day"
]
My code:
import boto3
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('Shops')
def lambda_handler(event, context):
day = event['day']
resp = table.get_item(Key={
"date":day
})
return resp['Item']
I want to write a query that takes one date as input and will return all orders on that day:
This was my input:
{
"day": "191215"
}