I am trying to put (insert) a nested object in my DynamoDB table. The object I have constructed as per the boto3 documentation is:
itm = {
'uid': {
'S': 'some-unique-id-value'
},
'myArray': {
'L': [
{
'propOne': {
'S': 'this is value of prop 1'
},
'createdOn': {
'S': str(time.time())
},
'isActive': {
'BOOL': True
},
'propTwo': {
'S': 'this is value of prop 2'
},
'propThree': {
'S': 'this is value of prop 3'
}
}
]
}
}
And then I put the item using the dynamoDB client:
dynamodb.put_item(TableName='myTableName', Item=itm)
But I am getting the exception:
botocore.exceptions.ParamValidationError: Parameter validation failed:
Unknown parameter in Item.myArray.L[0]: "propOne", must be one of: S, N, B, SS, NS, BS, M, L, NULL, BOOL
Unknown parameter in Item.myArray.L[0]: "createdOn", must be one of: S, N, B, SS, NS, BS, M, L, NULL, BOOL
Unknown parameter in Item.myArray.L[0]: "isActive", must be one of: S, N, B, SS, NS, BS, M, L, NULL, BOOL
Unknown parameter in Item.myArray.L[0]: "propTwo", must be one of: S, N, B, SS, NS, BS, M, L, NULL, BOOL
Unknown parameter in Item.myArray.L[0]: "propThree", must be one of: S, N, B, SS, NS, BS, M, L, NULL, BOOL
I am following this documentation:
My goal is to store the item as shown in this JSON object:
{
"uid":"some-uid-val",
"myArray":[
{
"propOne":"item 1 prop 1 value",
"createdOn":"123456",
"isActive":true,
"propTwo":"item 1 prop 2 value",
"propThree":"item 1 prop 3 value"
},
{
"propOne":"item 2 prop 1 value",
"createdOn":"123456",
"isActive":true,
"propTwo":"item 2 prop 2 value",
"propThree":"item 2 prop 3 value"
}
]
}
What am I doing wrong?