mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Introduce new /$DB/-/query endpoint, soft replaces /$DB?sql=... (#2363)
* Introduce new default /$DB/-/query endpoint * Fix a lot of tests * Update pyodide test to use query endpoint * Link to /fixtures/-/query in a few places * Documentation for QueryView --------- Co-authored-by: Simon Willison <swillison@gmail.com>
This commit is contained in:
parent
56adfff8d2
commit
a23c2aee00
21 changed files with 148 additions and 83 deletions
|
|
@ -55,6 +55,21 @@ The following tables are hidden by default:
|
|||
- Tables relating to the inner workings of the SpatiaLite SQLite extension.
|
||||
- ``sqlite_stat`` tables used to store statistics used by the query optimizer.
|
||||
|
||||
.. _QueryView:
|
||||
|
||||
Queries
|
||||
=======
|
||||
|
||||
The ``/database-name/-/query`` page can be used to execute an arbitrary SQL query against that database, if the :ref:`permissions_execute_sql` permission is enabled. This query is passed as the ``?sql=`` query string parameter.
|
||||
|
||||
This means you can link directly to a query by constructing the following URL:
|
||||
|
||||
``/database-name/-/query?sql=SELECT+*+FROM+table_name``
|
||||
|
||||
Each configured :ref:`canned query <canned_queries>` has its own page, at ``/database-name/query-name``. Viewing this page will execute the query and display the results.
|
||||
|
||||
In both cases adding a ``.json`` extension to the URL will return the results as JSON.
|
||||
|
||||
.. _TableView:
|
||||
|
||||
Table
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue