NotSupportedError: Python value cannot be converted to a database value

解决方法

cx_Oracle 版本 < 7.1

  1. perform all inserts in a single batch (but depending on size this might not be usable)
  2. create a new cursor for each batch (so that cx_Oracle calculates the types for each batch)
  3. use cursor.setinputsizes() to specify the types and sizes (may be cumbersome)
db_types = (d[1] for d in cursor_select.description)
cursor_insert.setinputsizes(*db_types)

cx_Oracle 版本 >= 7.1

该 bug 已被修复。
但又会有新的 bug:

 "DPI-1044: value cannot be represented as an Oracle number", // DPI_ERR_NUMBER_NO_REPR

暂且没找到解决方法,那还是用旧版的先吧。。

参考

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。