Getting Below Error:
{
"errorMessage": "name 'Emp_id' is not defined",
"errorType": "NameError",
"requestId": "4b66e8ca-28f8-4005-8589-3993d2d4d203",
"stackTrace": [
" File \"/var/task/lambda_function.py\", line 12, in lambda_handler\n hash_key=Emp_id, ScanIndexForward=True, limit=1\n"
]
}
import json
import boto3
from boto3.dynamodb.conditions import Key
def lambda_handler(event, context):
ddb = boto3.resource('dynamodb', region_name='ap-south-1')
table = ddb.Table('newtable2')
response = table.query (
hash_key=Emp_id, ScanIndexForward=True, limit=1
)
print(response['Items'])