在oracle10上使用预取的Python

2024-03-29 06:55:06 发布

您现在位置:Python中文网/ 问答频道 /正文

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!!!"

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


Tags: importclosedatabaseliconnectionstartcursor