home / docs / sections

sections: plugin_hooks:plugin-hook-table-actions

This data as json

id page ref title content breadcrumbs references
plugin_hooks:plugin-hook-table-actions plugin_hooks plugin-hook-table-actions table_actions(datasette, actor, database, table, request) datasette - Datasette class You can use this to access plugin configuration options via datasette.plugin_config(your_plugin_name) , or to execute SQL queries. actor - dictionary or None The currently authenticated actor . database - string The name of the database. table - string The name of the table. request - Request object or None The current HTTP request. This can be None if the request object is not available. This example adds a new table action if the signed in user is "root" : from datasette import hookimpl @hookimpl def table_actions(datasette, actor, database, table): if actor and actor.get("id") == "root": return [ { "href": datasette.urls.path( "/-/edit-schema/{}/{}".format( database, table ) ), "label": "Edit schema for this table", "description": "Add, remove, rename or alter columns for this table.", } ] Example: datasette-graphql ["Plugin hooks", "Action hooks"] [{"href": "https://datasette.io/plugins/datasette-graphql", "label": "datasette-graphql"}]
Powered by Datasette · Queries took 2.522ms