New plugin hook: canned_queries(), refs #852

This commit is contained in:
Simon Willison 2020-06-18 16:22:33 -07:00
commit 6c26345836
12 changed files with 203 additions and 50 deletions

View file

@ -129,3 +129,17 @@ def startup(datasette):
datasette._startup_hook_calculation = result.first()[0]
return inner
@hookimpl
def canned_queries(datasette, database):
async def inner():
return {
"from_async_hook": "select {}".format(
(
await datasette.get_database(database).execute("select 1 + 1")
).first()[0]
)
}
return inner