in source/lambdafunctions/SNSTriggerAWSTranslateLambda/lambda_function.py [0:0]
def put_dynamo(dynamo_object, dynamo_table):
table = DYNAMO_RESOURCE.Table(dynamo_table)
try:
response = table.put_item(
Item=dynamo_object,
ConditionExpression='attribute_not_exists(id_name)'
)
if DEBUG:
print("DEBUG dynamo put_item succeeded: {}".format(response))
except ClientError as e:
# Ignore the ConditionalCheckFailedException, bubble up other exceptions.
if e.response['Error']['Code'] != 'ConditionalCheckFailedException':
print("ERROR ClientError: {}".format(e))
return response