mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
/db/table/-/drop API, closes #1874
This commit is contained in:
parent
4f16e14d7a
commit
2865d3956f
6 changed files with 114 additions and 11 deletions
|
|
@ -559,6 +559,18 @@ Actor is allowed to insert rows into a table.
|
|||
|
||||
Default *deny*.
|
||||
|
||||
.. _permissions_drop_table:
|
||||
|
||||
drop-table
|
||||
----------
|
||||
|
||||
Actor is allowed to drop a database table.
|
||||
|
||||
``resource`` - tuple: (string, string)
|
||||
The name of the database, then the name of the table
|
||||
|
||||
Default *deny*.
|
||||
|
||||
.. _permissions_execute_sql:
|
||||
|
||||
execute-sql
|
||||
|
|
|
|||
|
|
@ -539,3 +539,20 @@ To return the newly inserted rows, add the ``"return_rows": true`` key to the re
|
|||
}
|
||||
|
||||
This will return the same ``"inserted"`` key as the single row example above. There is a small performance penalty for using this option.
|
||||
|
||||
.. _TableDropView:
|
||||
|
||||
Dropping tables
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
To drop a table, make a ``POST`` to ``/<database>/<table>/-/drop``. This requires the :ref:`permissions_drop_table` permission.
|
||||
|
||||
::
|
||||
|
||||
POST /<database>/<table>/-/drop
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer dstok_<rest-of-token>
|
||||
|
||||
If successful, this will return a ``200`` status code and a ``{"ok": true}`` response body.
|
||||
|
||||
Any errors will return ``{"errors": ["... descriptive message ..."], "ok": false}``, and a ``400`` status code for a bad input or a ``403`` status code for an authentication or permission error.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue