Skip to content

Instantly share code, notes, and snippets.

@narenaryan
Last active January 10, 2021 18:53
Show Gist options
  • Select an option

  • Save narenaryan/702771c2083698b0ee5bdf01be25081c to your computer and use it in GitHub Desktop.

Select an option

Save narenaryan/702771c2083698b0ee5bdf01be25081c to your computer and use it in GitHub Desktop.
cursor-illu
def main():
sql_query = 'SELECT * FROM film'
with connect(**config) as conn:
with conn.cursor("film") as cur:
# This fetches only 200 records from DB as batches
# If you don't specify, the default value is 2000
cur.itersize = 200
cur.execute(sql_query)
for row in cur:
print(row) # Use row
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment