home / docs / sections_fts

Menu

sections_fts: 63

This data as json

rowid title content
63 await .add_query(database, name, sql, ...) Adds a stored query. async def add_query( self, database, name, sql, *, title=None, description=None, description_html=None, hide_sql=False, fragment=None, parameters=None, is_write=False, is_private=False, is_trusted=False, source="plugin", owner_id=None, on_success_message=None, on_success_message_sql=None, on_success_redirect=None, on_error_message=None, on_error_redirect=None, replace=True, ): ... database - string The name of the database this query should belong to. name - string The name of the stored query, used in the URL for that query. sql - string The SQL for the stored query. title - string, optional A display title for the query. description - string, optional A plain text description. description_html - string, optional An HTML description. hide_sql - boolean, optional Set to True to hide the SQL by default on the query page. fragment - string, optional A URL fragment to append to query links, for example "chart" . parameters - list of strings, optional Explicit parameter names for the query form. If omitted, Datasette derives parameters from the SQL. is_write - boolean, optional Set to True for writable queries. They will the run against the SQLite write connection for the database. is_private - boolean, optional Set to True for private queries. Private queries can only be viewed, updated or deleted by their owner. is_trusted - boolean, optional Set to True for trusted stored queries . source - string, optional Identifies where the query came from. Defaults to "plugin" . owner_id - string, optional Actor ID of the query owner, used by private query permissions. on_success_message , on_success_message_sql , on_success_redirect , on_error_message , on_error_redirect - strings, optional Options for writable queries . replace - boolean, optional Defaults to True , which replaces any existing stored query with the same database and name . Set this to False to raise a SQLite integrity error if the query already exists. Example: await datasette.add_query( database="fixtures", name="recent_rows", sql="select * from facetable order by created desc limit 10", title="Recent rows", source="my-plugin", )
Powered by Datasette · Queries took 3.345ms