I have data coming out of an XML parser that contains instrument readings. Samples of the data are reproduced below:
cimReading = [['2012-08-15 10:05:13.101485', ['0x46'], ['0x32'], ['1.234'], ['5.678'], ['9.123'],
['4.567'], ['0x98'], ['0x97']],
['2012-08-15 10:05:13.101979', ['0x47'], ['0x33'], ['8.901'], ['2.345'], ['6.789'],
['0.123'], ['0x96'], ['0x95']]]
I'm trying to loop over the list items and put them away in a table, cim76_dmt that was previously defined in Python with sqlite3. Here is the code I'm using to try to do this:
for devList in cimReading:
print devList
cim76TabPopulate.execute('INSERT INTO cim76_dmt VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)',
devList)
BenchDB.commit()
cim76TabPopulate.close()
Here is the error message I receive upon execution:
['2012-08-15 10:40:21.110140', ['0x46'], ['0x32'], ['1.234'], ['5.678'], ['9.123'], ['4.567'], ['0x98'], ['0x97']]
EXCEPTION...
(<class 'sqlite3.InterfaceError'>, InterfaceError('Error binding parameter 1 - probably unsupported type.',), <traceback object at 0x1007a7518>)
So, I'm having a problem mapping a list item to a SQL table field. I think there should be a way to do this, but another possibility may be to tweak the XML parsing so I generate a single list of multiple strings for each record. I'd welcome any suggestions or advice on this.
Thanks in advance!