I created a DynamoDB table that is used for storing metadata, with different attributes for different types of data (file size, date, etc., as separate attributes).
I am trying to take a Python3 dictionary and use it as the source for a bunch of attributes that need to be uploaded to the table. So far, I've been able to successfully upload the entire dictionary as one attribute, but I want each key:value pair to be its own attribute in the database. In other words, each key:value pair from the Python3 dictionary should end up as its own key:value pair in the DynamoDB table. I'm aware my code below is not designed to that so far.
Here is my code so far:
file_attributes = dict(file.items())
# Add all metadata to DynamoDB:
response = table.update_item(
UpdateExpression="set File_attributes = :f,"
Key={
'file_name': key,
},
ExpressionAttributeValues={
':f': file_attributes,
},
ReturnValues="UPDATED_NEW"
)