I have an array with JSON content like this
{
"time":datetimeValue,
"Type":"TypeValue",
"ID":"IDValue",
"ReceiveValue":{
"Sensor1": Value1,
"Sensor2":Value2,
"Sensor3": Value3,
},
"TransmitValue":{
"Sensor1": Value1,
"Sensor2":Value2,
"Sensor3": Value3,
}
}
I tried to insert all of my records to PostgreSQL database in this array using this code
args_str = ','.join(self.cursor.mogrify("(%s,%s,%s,%s,%s)", x.values()) for x in self.records)
self.cursor.execute("INSERT INTO util VALUES " + (args_str))
But I got this error
'dict_values' object does not support indexing
Is there any way to solve this error or is there are any way to insert multiple records with mogrify
function?