79593528

Date: 2025-04-26 02:48:43
Score: 1.5
Natty:
Report link

I like what @LittleNyima has shared. In addition to that, you can also execute the query multiple times with LIMIT and OFFSET if the solution allows it.

def generate_dataset(cursor, limit=1000, offset=200):
    query_with_limit = query + f" LIMIT {limit} OFFSET {offset}" 
    cursor.execute(query_with_limit)
    rows = cursor.fetchall()
    if not rows:
        return tuple()
    else:
        for row in rows:
            # some transformation
            yield tuple_version_of_row
Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @LittleNyima
  • Low reputation (1):
Posted by: k3sh4v