V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
415829566
V2EX  ›  Python

python3 连接 oracle 数据库,批量插入数据报错

  •  
  •   415829566 · 2018-05-31 10:29:32 +08:00 · 2202 次点击
    这是一个创建于 2150 天前的主题,其中的信息可能已经有所发展或是发生改变。
    如题:
    报了这个错误:TypeError: expecting integer

    但是单条插入没问题
    2 条回复    2018-05-31 10:33:45 +08:00
    415829566
        1
    415829566  
    OP
       2018-05-31 10:31:00 +08:00
    附上代码:
    def insertOracleTable(self,table_name,datas=[]):
    self.conndb()
    #insert_sql="insert into "+table_name+" values(:1,:2,:3,:4,:5,:6,:7)"
    print(insert_sql)
    print(datas)
    self.cursor.prepare(insert_sql)
    self.cursor.executemany(None,datas)
    self.commitdb()
    self.closedb()
    415829566
        2
    415829566  
    OP
       2018-05-31 10:33:45 +08:00
    附上数据:
    [('数仓 1 节点', 'DW_TBL', 1214, 1136.97, 77.03, 93.65, datetime.datetime(2018, 5, 31, 10, 26, 42)), ('数仓 2 节点', 'TBS_DW_ODS_DAT', 154, 139.88, 14.12, 90.83, datetime.datetime(2018, 5, 31, 10, 26, 42))]
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   926 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 20:32 · PVG 04:32 · LAX 13:32 · JFK 16:32
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.