微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用 python 中的 Teradatasql 模块将数据上传到 Teradata 时出错

如何解决使用 python 中的 Teradatasql 模块将数据上传到 Teradata 时出错

我正在尝试使用 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,'699831ad-0fa60249f33e']]

查看数据类型,它们似乎匹配:

对于列表批处理:

TEST_IND               int64
SOURCE_LABEL           object
OPPORTUNITYID          object
dtype: object

对于 mytableinteradata:

TEST_IND                        I 
SOURCE_LABEL                    CV
OPPORTUNITYID                   CV

我之前在不同的项目中使用过相同的代码,没有任何问题。我不确定这里有什么不同。关于该错误意味着什么以及如何解决它有什么想法吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。