我正在尝试使用 python 中的 TeradataSQL 模块将数据上传到 Teradata 中的表中,但出现以下错误:
A failure occurred while executing rows 1 through 2 of a batch request...Caused by [Version 17.0.0.8] [Session 21731976] [Teradata Database] [Error 3939]
There is a mismatch between the number of parameters specified and the number of parameters required.
这是我正在使用的代码:
import teradatasql
listbatch = x.values.tolist()
with teradatasql.connect ('{"host":"whomooz","user":"guest","password":"please"}') as con:
with con.cursor () as cur:
cur.executemany ("insert into mytableinTeradata ('?,?,?')", listbatch)
这就是 listbatch 的样子
[[0, 'Rep Entered', '8cfc12c9-000d3a8fc913'],
[0, 'Rep Entered', '699831ad-0fa60249f33e']]
查看数据类型,它们似乎匹配:
对于列表批处理:
TEST_IND int64
SOURCE_LABEL object
OPPORTUNITYID object
dtype: object
对于 mytableinTeradata:
TEST_IND I
SOURCE_LABEL CV
OPPORTUNITYID CV
我之前可以在不同的项目中使用相同的代码,没有任何问题。我不确定这里有什么不同。关于该错误的含义以及如何解决它的任何想法?