Hello, I am facing the similar issue. That I want to insert entire dataset into database table.
I followed the code by @lrose but getting below error.
Code:
data1 = system.tag.read("[default]TEST/Tag").value
pyData = system.dataset.toPyDataSet(data1)
query = "INSERT INTO MyTable (C1, C2, C3, C4, C5, C6, C7) VALUES %s"
valueArgs = ','.join(['(?,?,?,?,?,?,?)'] * data1.getRowCount())
argList = [row for row in pyData]
system.db.runPrepUpdate(query % valueArgs, argList, 'MyDB')
Error:
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Unable to decode arguments
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:351)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:325)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:278)
at com.inductiveautomation.ignition.client.script.ClientDBUtilities._runPrepStmt(ClientDBUtilities.java:288)
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:261)
... 23 more
Caused by: java.io.InvalidClassException: failed to read class descriptor
I am not sure what I am missing here.