当我调用cursor.executemany()时cx_Oracle MemoryError

时间:2015-04-17 08:47:15

标签: python cx-oracle

当我调用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() 

1 个答案:

答案 0 :(得分:0)

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