【问题标题】:cx_Oracle MemoryError when i call cursor.executemany()当我调用 cursor.executemany() 时出现 cx_Oracle MemoryError
【发布时间】:2015-12-30 22:32:37
【问题描述】:

当我调用 cursor.executemany() 时出现 cx_Oracle MemoryError。此错误仅在数据较大时发生。我用一些数据试了一下,没问题。请,我是python和一般编程的新手。谢谢大家...

import string, cx_Oracle, time
startscript = time.time() 
ora_conn = cx_Oracle.connect("")      
ora_cursor = ora_conn.cursor()      

ora_cursor.execute("truncate table table")

ora_cursor.execute("""SELECT * FROM schema.tableA""")


ResultSet_Py_List = []
for column1, column2, column3 in ora_cursor:
     try:
       ResultSet_Py_List.append((column1, column2, column3 ))
     except AttributeError: 
       pass


ora_cursor.prepare("""INSERT INTO schema.TableA (column1, column2, column3 ) 
        VALUES (:column1, :column2, :column3)""")

ora_cursor.executemany(None, ResultSet_Py_List)
ora_conn.commit() 

【问题讨论】:

    标签: python cx-oracle


    【解决方案1】:

    解决了。我发现它与记忆有关。在我发现 32 位只能使用 4 GB 的 RAM 后,我安装了一个 64 位的 python 和 oracle 客户端

    【讨论】:

      猜你喜欢
      • 2010-11-14
      • 1970-01-01
      • 2019-03-02
      • 2018-05-03
      • 2020-05-23
      • 1970-01-01
      • 2019-05-26
      • 1970-01-01
      • 2015-11-01
      相关资源
      最近更新 更多