amazon dynamodb - Error when creating items AWS Lambda to DynamDb with python -
i trying create new item in table , every time run following code:
from __future__ import print_function decimal import * import boto3 import json def my_handler(event, context): marker = event['m'] latitude = decimal(event['lat']) longitude = decimal(event['lon']) tableminfo = 'minfo' client = boto3.client('dynamodb') client.put_item( tablename = tableminfo, item = { 'marker':{'n' : marker}, 'latitude':{'n' : latitude}, 'longitude':{'n' : longitude}, } ) success = "success" return {'success' : success}
with following test parameters in lambda
{ "m": 1, "lat": 52.489505, "lon": 13.389687 }
i receive error on following lines: 17, "my_handler", "'longitude':{'n' : longitude},"
you must update values string:
client.put_item( tablename = tableminfo, item = { 'marker':{'n' : str(marker)}, 'latitude':{'n' : str(latitude)}, 'longitude':{'n' : str(longitude)}, } )
Comments
Post a Comment