Skip to content

Commit

Permalink
fetch 10k rows at the time
Browse files Browse the repository at this point in the history
  • Loading branch information
kukicola committed Feb 18, 2024
1 parent f069b28 commit b605d6d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/sql2csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ def execute_query(cursor, query):
def fetch_rows(cursor):
""" Fetch and yield rows """

for row in cursor.fetchall():
yield row
while rows := cursor.fetchmany(10000):
for row in rows:
yield row


def fetch_headers(cursor):
Expand Down

0 comments on commit b605d6d

Please # to comment.