[cx-oracle-users] iterating using fetchmany
Brought to you by:
atuining
|
From: Rodman, D. <dr...@bu...> - 2014-11-25 21:39:35
|
I'm working with python and oracle using the cx_Oracle module. I'm having issues getting fetchmany to iterate over my result set correctly. The table in the query, i2test, has over 20,000 rows, however the while loop hangs when it gets to about 1,800 rows. If I remove the order by clause... the loop hangs at about 12,000. Any advice?
cursor_metadata = cx_Oracle.Cursor(i_connection)
query_select = """SELECT name, code, cname, TO_CHAR(updatedate), TO_CHAR(downloaddate), TO_CHAR(importdate)
FROM imetadata.i2test
WHERE code like '%DIN%' AND
cd = 'N'
ORDER BY code"""
cursor_metadata.execute(query_select)
count = 0
results = cursor_metadata.fetchmany(100)
while results:
print count
count += 1
results = cursor_metadata.fetchmany(100)
I realize this is probably something simple... thanks in advance.
Dan
|