Don't explain an explain even in the demo, refs #2293

This commit is contained in:
Simon Willison 2024-03-05 18:14:55 -08:00
commit 4d24bf6b34
3 changed files with 13 additions and 8 deletions

View file

@ -1557,7 +1557,10 @@ This example adds a new query action linking to a page for explaining a query:
@hookimpl
def query_actions(datasette, database, sql):
def query_actions(datasette, database, query_name, sql):
# Don't explain an explain
if sql.lower().startswith("explain"):
return
return [
{
"href": datasette.urls.database(database)
@ -1571,7 +1574,6 @@ This example adds a new query action linking to a page for explaining a query:
},
]
.. _plugin_hook_database_actions:
database_actions(datasette, actor, database, request)