mirror of
https://github.com/simonw/datasette.git
synced 2026-09-28 12:54:10 +02:00
parent
063eeae83d
commit
1538832830
8 changed files with 224 additions and 33 deletions
|
|
@ -9,6 +9,7 @@ Changelog
|
|||
Unreleased
|
||||
----------
|
||||
|
||||
- Fixed incorrect counts when clicking **count all** on filtered table pages. The button now uses a new :ref:`POST count endpoint <TableCountView>`. (:issue:`2914`)
|
||||
- Datasette now uses `httpx2 <https://httpx2.pydantic.dev/>`__, the Pydantic-maintained continuation of `httpx <https://www.python-httpx.org/>`__, in place of ``httpx``. The public API is the same, but responses returned by :ref:`internals_datasette_client` are now ``httpx2.Response`` objects rather than ``httpx.Response``. Plugins that use ``isinstance()`` checks against ``httpx.Response`` should be updated to use ``httpx2``. **Plugins that use httpx without explicitly depending on it** will need to add an explicit dependency or switch to `httpx2`.
|
||||
|
||||
.. _v1_0_a39:
|
||||
|
|
|
|||
|
|
@ -1326,6 +1326,23 @@ The following extras are available for arbitrary SQL query responses and stored,
|
|||
|
||||
.. [[[end]]]
|
||||
|
||||
.. _TableCountView:
|
||||
|
||||
Counting all matching rows
|
||||
--------------------------
|
||||
|
||||
``POST /<database>/<table>/-/count`` returns an exact count of the rows matching the table's query string filters::
|
||||
|
||||
POST /fixtures/facetable/-/count?state=CA
|
||||
|
||||
{"ok": true, "count": 10}
|
||||
|
||||
The endpoint supports the same column, search and plugin filters as the table page. Pagination and display options such as ``_next``, ``_size`` and ``_sort`` do not affect the count.
|
||||
|
||||
This requires ``view-table`` permission. ``execute-sql`` permission is only needed if using ``_where`` filters.
|
||||
|
||||
Unlike the ``count`` extra, this count is not capped by the row count limit. The usual SQL time limit still applies; a timed-out count returns a 400 JSON error.
|
||||
|
||||
.. _TableAutocompleteView:
|
||||
|
||||
Table autocomplete
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue