Ahmed Adebiyi Oladapo
Ahmed Adebiyi Oladapo

Reputation: 31

cx_Oracle MemoryError when i call cursor.executemany()

cx_Oracle MemoryError when i call cursor.executemany(). this error only occurs when the data is large. i tried it with a few data and it was fine. please, i am new to python and programming in general. thanks guys...

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() 

Upvotes: 2

Views: 4208

Answers (1)

Ahmed Adebiyi Oladapo
Ahmed Adebiyi Oladapo

Reputation: 31

solved. I found out it has to do with memory. I installed a 64bit python and oracle client after i found out that 32bit can only use 4 Gigabyte of RAM

Upvotes: 1

Related Questions