开发者

MySQL insert single variable with python

Im having problem with single value inserts. Using pyodbc

LL= []
....
sqla = 'INSERT INTO d.table VALUES (?,?,?,?,?,?,?)'
csr.executemany(sqla, LL)

Works开发者_运维知识库, if LL is single column of data as a list...does not work.

LL= []
....
sqla = 'INSERT INTO d.table VALUES (?)'
csr.execute(sqla, LL)

How do I fix?

Then

LL= []
....
sqla = 'INSERT INTO d.table VALUES (?)'
csr.execute(sqla, LL)

If LL is Id only, The database table has cols of ID, AAA,BBB, CCC, How do I insert....

LL= [['TDW'], ['TD0'], ['TD0'], ['TDW'], ['TD10'] ]


sqla = 'INSERT INTO d.table (column_name) VALUES (?)'

This is right syntax of INSERT QUERY.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜