Python在Oracle 10上使用PRE-FETCH

时间:2009-11-11 17:00:56

标签: python oracle10g

import cx_Oracle
import wx

print "Start..." + str(wx.Now())

base = cx_Oracle.makedsn('xxx', port, 'yyyy')

connection = cx_Oracle.connect(user name, password, base)

cursor = connection.cursor()

cursor.execute('select data from t_table')

li_row = cursor.fetchall()

data = []

for row in li_row:

    data.append(row[0])

cursor.close()

connection.close()

print "End..." + str(wx.Now())

print "DONE!!!"

有没有办法在这个程序中集成预取?我的目标是尽快从数据库中获取数据。

1 个答案:

答案 0 :(得分:0)

获取10000行......

cursor.arraysize = 10000