home / docs / sections

sections

1 row where page = "plugin_hooks", references = "[]" and title = "The "

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: breadcrumbs (array)

id ▼ page ref title content breadcrumbs references
plugin_hooks:plugin-resources-sql plugin_hooks plugin-resources-sql The The resources_sql() classmethod returns a SQL query that lists all resources of that type that exist in the system. It can be async because Datasette calls it with await , and it receives the current datasette instance plus an optional actor argument. This query is used by Datasette to efficiently check permissions across multiple resources at once. When a user requests a list of resources (like tables, documents, or other entities), Datasette uses this SQL to: Get all resources of this type from your data catalog Combine it with permission rules from the permission_resources_sql hook Use SQL joins and filtering to determine which resources the actor can access Return only the permitted resources The SQL query must return exactly two columns: parent - The parent identifier (e.g., database name, collection name), or NULL for top-level resources child - The child identifier (e.g., table name, document ID), or NULL for parent-only resources For example, if you're building a document management plugin with collections and documents stored in a documents table, your resources_sql() might look like: @classmethod async def resources_sql(cls, datasette, actor=None) -> str: return """ SELECT collection_name AS parent, document_id AS child FROM documents """ This tells Datasette "here's how to find all documents in the system - look in the documents table and get the collection name and document ID for each … ["Plugin hooks", "register_actions(datasette)"] []

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [sections] (
   [id] TEXT PRIMARY KEY,
   [page] TEXT,
   [ref] TEXT,
   [title] TEXT,
   [content] TEXT,
   [breadcrumbs] TEXT,
   [references] TEXT
);
Powered by Datasette · Queries took 1.2ms