Changes between Version 3 and Version 4 of Ticket #36889


Ignore:
Timestamp:
Jan 28, 2026, 3:43:27 PM (97 minutes ago)
Author:
Natalia Bidart
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36889 – Description

    v3 v4  
    55Here is the current implementation:
    66
    7 {{{
     7{{{#!python
    88def cursor_iter(cursor, sentinel, col_count, itersize):
    9 """
    10 Yield blocks of rows from a cursor and ensure the cursor is closed when
    11 done.
    12 """
    13 try:
    14 for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
    15 yield rows if col_count is None else [r[:col_count] for r in rows]
    16 finally:
    17 cursor.close()
     9    """
     10    Yield blocks of rows from a cursor and ensure the cursor is closed when
     11    done.
     12    """
     13    try:
     14        for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
     15            yield rows if col_count is None else [r[:col_count] for r in rows]
     16    finally:
     17        cursor.close()
    1818}}}
    1919
Back to Top