Reputation: 1
I'm trying to use put_item to add an array of strings into dynamodb.
This is the code that I wrote:
table = dynamodb.Table('variables')
string = [first line, second line, third line]
table.put_item(
Item = {
"variables": { "SS": [ string ]}
}
)
But I'm getting the following error:
"errorMessage": "An error occurred (ValidationException) when calling the PutItem operation: One or more parameter values were invalid: Missing the key strings in the item"
I've tried reading through the documentation but without luck.
Upvotes: 0
Views: 1528
Reputation: 3387
If you use Table
resource, you don't need to specify DynamoDB types like SS
. Just put your item into dict
, otherwise you will see these types being interpreted as actual data.
There is a bit of confusion between client.put_item()
which expects raw data with types, and Table.put_item()
which expects regular dict. Whenever possible, use table one.
In your case it should look something like table.put_item(Item = {"variables": string})
Upvotes: 0