Petl
python模块执行ETL操作。Parameters for query must be list or tuple
)错误。以下是我尝试过的示例代码,
from petl import todb
import mysql.connector
try:
table = [['foo', 'bar'], ['a', 1], ['b', 2], ['c', 2]]
connection = mysql.connector.connect(host='10.100.0.000',database='test',user='root',password='123')
connection.cursor().execute('SET SQL_MODE=ANSI_QUOTES')
todb(table, connection, 'petlTest')
except Exception, exception:
print exception
注意:表petlTest已经创建了列foo和bar。
答案 0 :(得分:0)
我通过将mysql.connector
更改为mysql-python
模块来修复此问题。
答案 1 :(得分:-1)
首先删除表“petlTest”
drop TABLE petlTest