I'm adding data from csv file using lambda function the data is added but there's an error in my table in dynamodb I see my headers also a row in table here's my code :
import boto3
s3=boto3.client("s3")
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('maysales')
def lambda_handler(event, context):
bucketna=event['Records'][0]['s3']['bucket']['name']
s3_name=event['Records'][0]['s3']['object']['key']
response=s3.get_object(Bucket=bucketn,Key=s3_name)
data=response['Body'].read().decode("utf-8")
salesnbs=data.split("\n")
for ko in salesnbs:
kos=ko.split(",")
table.put_item(
Item = {
"Date": kos[0],
"name": kos[1],
"fam": kos[2],
"locati": kos[3],
"adress": kos[4],
"country": kos[5],
"city": kos[6]
})
my table contains headers already: