id,page,ref,title,content,breadcrumbs,references plugin_hooks:plugin-hook-view-actions,plugin_hooks,plugin-hook-view-actions,"view_actions(datasette, actor, database, view, 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. view - string The name of the SQL view. request - Request object or None The current HTTP request. This can be None if the request object is not available. Like table_actions(datasette, actor, database, table, request) but for SQL views.","[""Plugin hooks"", ""Action hooks""]",[] 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""}]" plugin_hooks:plugin-hook-row-actions,plugin_hooks,plugin-hook-row-actions,"row_actions(datasette, actor, request, database, table, row)","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 . request - Request object or None The current HTTP request. database - string The name of the database. table - string The name of the table. row - sqlite.Row The SQLite row object being displayed on the page. Return links for the ""Row actions"" menu shown at the top of the row page. This example displays the row in JSON plus some additional debug information if the user is signed in: from datasette import hookimpl @hookimpl def row_actions(datasette, database, table, actor, row): if actor: return [ { ""href"": datasette.urls.instance(), ""label"": f""Row details for {actor['id']}"", ""description"": json.dumps( dict(row), default=repr ), }, ] Example: datasette-enrichments","[""Plugin hooks"", ""Action hooks""]","[{""href"": ""https://datasette.io/plugins/datasette-enrichments"", ""label"": ""datasette-enrichments""}]" plugin_hooks:plugin-hook-query-actions,plugin_hooks,plugin-hook-query-actions,"query_actions(datasette, actor, database, query_name, request, sql, params)","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. query_name - string or None The name of the canned query, or None if this is an arbitrary SQL query. request - Request object The current HTTP request. sql - string The SQL query being executed params - dictionary The parameters passed to the SQL query, if any. Populates a ""Query actions"" menu on the canned query and arbitrary SQL query pages. This example adds a new query action linking to a page for explaining a query: from datasette import hookimpl import urllib @hookimpl 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) + ""?"" + urllib.parse.urlencode( { ""sql"": ""explain "" + sql, } ), ""label"": ""Explain this query"", ""description"": ""Get a summary of how SQLite executes the query"", }, ] Example: datasette-create-view","[""Plugin hooks"", ""Action hooks""]","[{""href"": ""https://datasette.io/plugins/datasette-create-view"", ""label"": ""datasette-create-view""}]" plugin_hooks:plugin-hook-homepage-actions,plugin_hooks,plugin-hook-homepage-actions,"homepage_actions(datasette, actor, 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 . request - Request object The current HTTP request. Populates an actions menu on the top-level index homepage of the Datasette instance. This example adds a link an imagined tool for editing the homepage, only for signed in users: from datasette import hookimpl @hookimpl def homepage_actions(datasette, actor): if actor: return [ { ""href"": datasette.urls.path( ""/-/customize-homepage"" ), ""label"": ""Customize homepage"", } ]","[""Plugin hooks"", ""Action hooks""]",[] plugin_hooks:plugin-hook-database-actions,plugin_hooks,plugin-hook-database-actions,"database_actions(datasette, actor, database, 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. request - Request object The current HTTP request. Populates an actions menu on the database page. This example adds a new database action for creating a table, if the user has the edit-schema permission: from datasette import hookimpl @hookimpl def database_actions(datasette, actor, database): async def inner(): if not await datasette.permission_allowed( actor, ""edit-schema"", resource=database, default=False, ): return [] return [ { ""href"": datasette.urls.path( ""/-/edit-schema/{}/-/create"".format( database ) ), ""label"": ""Create a table"", } ] return inner Example: datasette-graphql , datasette-edit-schema","[""Plugin hooks"", ""Action hooks""]","[{""href"": ""https://datasette.io/plugins/datasette-graphql"", ""label"": ""datasette-graphql""}, {""href"": ""https://datasette.io/plugins/datasette-edit-schema"", ""label"": ""datasette-edit-schema""}]"