I cant get the insert to work in this code. I have other numpy to mysql that work fine. But there are no errors in running code. Mysql gives no errors. Using python 2.7 and pyodbc on winx64.
p = np.arange(1, 33, 3)
print p
def prow (f1,series):
rowp=[]
series = series.tolist()
ss = series[8:]
rowp.append(1)
rowp.extend(ss)
print len (rowp)
print rowp
print type(rowp)
InSQL = 'INSERT INTO test._t VALUES (1, 25, 28, 31)'
print InSQL
# csr.executemany(InSQL,rowp)
csr.execute(InSQL)
print 1234
cxn.commit
prow('foo', p)
MySql is below:
CREATE TABLE `_t` (
`Id` int(11) DEFAULT NULL,
`T1` float(12,4) DEFAULT NULL,
`T2` decimal(12,4) DEFAULT NULL,
`T7` float(12,4) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
This print statements give;
[ 1 4 7 10 13 16 19 22 25 28 31]
4
[1, 25, 28, 31]
<type 'list'>
INSERT INTO test._t VALUES (1, 25, 28, 31)
1234
Using the "INSERT INTO test._t VALUES (1, 25, 28, 31)" in mysql shell works just fine. there is alot of redundant code, right now. The idea is to use executemany, but I cant the
the simple code to work.
csrandcxn?