Repository navigation
?_stream=1 uses smaller pages after a timeout - #3092
Merged
Merged
Conversation
Streaming fetches pages of max_returned_rows, and each page still has to finish inside sql_time_limit_ms. A table or view that was slow to compute could be streamed at 100 rows a page but returned a 500 QueryInterrupted at 1,000, or dropped the connection if a later page was the slow one. A page that is interrupted is now fetched again using the default page size, which is then used for the rest of the stream. That size is capped at max_returned_rows, because a longer page is cut short with no next page. A ?_size= in the URL still sets the size and gets the error. Also fixes max_returned_rows of 0, which means no limit: streaming used it as the page size and returned no rows. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016BvfqDPa3tXaNL3aFk4eYj
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3092 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 80 80
Lines 14282 14301 +19
=====================================
- Misses 14282 14301 +19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The docs now only say that streamed pages are up to max_returned_rows rows each. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016BvfqDPa3tXaNL3aFk4eYj
simonw
commented
Nov 20, 2026
| ``row_stream`` yields the rows on the current page. If the URL includes ``?_stream=1`` it carries on past the end of that page, fetching one page at a time, until it has yielded every row in the table or view. Your function does not need to know which of those is happening. | ||
|
|
||
| Use ``async for rows in row_stream.pages()`` to receive a list of rows for each page instead of one row at a time. When streaming every row those pages are :ref:`setting_max_returned_rows` rows each, unless the URL sets a different ``?_size=``. | ||
| Use ``async for rows in row_stream.pages()`` to receive a list of rows for each page instead of one row at a time. When streaming every row those pages are up to :ref:`setting_max_returned_rows` rows each, unless the URL sets a different ``?_size=``. If fetching a page that size takes longer than :ref:`setting_sql_time_limit_ms`, that page and the ones after it use the default page size instead. |
Owner
Author
There was a problem hiding this comment.
Documentation is too thorough.
simonw
added a commit
that referenced
this pull request
Nov 23, 2026
Refs #1048, #1342, #1479, #1553, #1611, #1627, #1630, #1671, #1674, #1822, #1841, #1873, #1914, #1919, #1973, #2045, #2073, #2145, #2253, #2356, #2419, #2713, #2805, #2807, #2810, #2826, #2942, #2967, #3070, #3074, #3075, #3078, #3079, #3081, #3082, #3083, #3084, #3085, #3087, #3088, #3089, #3090, #3091, #3092, #3093, #3097, #3098, #3099, #3100, #3101, #3102, #3103, #3104, #3105, #3106, #3107, #3108, #3109, #3111, #3112, #3113, #3115
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #3070, which fixes a regression it introduced.
Since #3070,
?_stream=1fetches pages ofmax_returned_rows(1,000 by default), and each page still has to finish insidesql_time_limit_ms. A table or view that is slow to compute now returns a 500QueryInterrupted, or drops the connection if a later page is the slow one.max_returned_rows. That size is used for the rest of the stream.?_size=in the URL still sets the page size and gets the error.max_returned_rowsof 0 (no limit) streamed no rows. It now uses the default page size.Tests: 11 new cases in
tests/test_renderer_streaming.py, 7 of which fail without the fix. The full suite passes. Checked by hand against a view costing about 2ms a row: a 500 onmain, all 2,000 rows with this change.A stream that falls back waits up to
sql_time_limit_msonce before it retries.The only docs change is that
row_stream.pages()pages are now described as "up to"max_returned_rowsrows.🤖 Generated with Claude Code
https://claude.ai/code/session_016BvfqDPa3tXaNL3aFk4eYj