Skip to content

fix: stream records lazily in write_records and _execute_chunk_v2#800

Open
shivamsharma2106 wants to merge 2 commits into
developfrom
fix/generating-command-oom-list-materialization
Open

fix: stream records lazily in write_records and _execute_chunk_v2#800
shivamsharma2106 wants to merge 2 commits into
developfrom
fix/generating-command-oom-list-materialization

Conversation

@shivamsharma2106
Copy link
Copy Markdown
Collaborator

@shivamsharma2106 shivamsharma2106 commented May 29, 2026

Problem:
_execute_chunk_v2 was accumulating all records into a list before writing them, causing OOM (out-of-memory) errors when generating commands produced large result sets. Similarly, write_records was materializing the full iterator into a list upfront.

Fix:

  • In _execute_chunk_v2: write each record immediately as it is generated instead of buffering all records first.
  • In write_records: return early if records is NotImplemented instead of materializing into an empty list.

This makes both methods stream records lazily, avoiding unnecessary memory allocation.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant