fix: report custom query CSV truncation in response headers

Expose the row limit and truncation flag so clients can detect incomplete CSV exports. Keep custom query CSV within the configured limit when it equals the page size. Fixes #1553.
This commit is contained in:
kokokoXUY 2026-09-26 11:41:45 +08:00
commit 28c411679c
4 changed files with 95 additions and 2 deletions

View file

@ -45,6 +45,13 @@ The following options can be used to customize the CSVs returned by Datasette.
``?_dl=on``
Causes Datasette to return a ``content-disposition: attachment; filename="filename.csv"`` header.
Custom SQL query CSV responses include a ``Datasette-Truncated`` response
header with the value ``true`` or ``false``. A value of ``true`` means rows
were omitted because of the :ref:`setting_max_returned_rows` limit. The
``Datasette-Max-Returned-Rows`` header reports that limit, including ``0``
when it is disabled. These headers are also available to cross-origin browser
clients when CORS is enabled.
Streaming all records
---------------------