python-cx_Oracle/samples/tutorial/query_arraysize.py
2020-12-08 11:47:53 -07:00

26 lines
807 B
Python

#------------------------------------------------------------------------------
# query_arraysize.py (Section 3.5)
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
#------------------------------------------------------------------------------
import cx_Oracle
import time
import db_config
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
start = time.time()
cur = con.cursor()
cur.prefetchrows = 100
cur.arraysize = 100
cur.execute("select * from bigtab")
res = cur.fetchall()
# print(res) # uncomment to display the query results
elapsed = (time.time() - start)
print(elapsed, "seconds")