Skip to content

Instantly share code, notes, and snippets.

@robsmith1776
Created February 26, 2016 00:34
Show Gist options
  • Save robsmith1776/1447456649e0f5ad81dd to your computer and use it in GitHub Desktop.
Save robsmith1776/1447456649e0f5ad81dd to your computer and use it in GitHub Desktop.
ResultIter - for pymssql
def ResultIter(cursor, arraysize=1000):
'An iterator that uses fetchmany to keep memory usage down'
while True:
results = cursor.fetchmany(arraysize)
if not results:
break
for result in results:
yield result
@robsmith1776
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment