{"ok": true, "database": "docs", "table": "sections", "rows": [{"id": "internals:datasette-add-query", "page": "internals", "ref": "datasette-add-query", "title": "await .add_query(database, name, sql, ...)", "content": "Adds a stored query. \n                     async def add_query(\n    self,\n    database,\n    name,\n    sql,\n    *,\n    title=None,\n    description=None,\n    description_html=None,\n    hide_sql=False,\n    fragment=None,\n    parameters=None,\n    is_write=False,\n    is_private=False,\n    is_trusted=False,\n    source=\"plugin\",\n    owner_id=None,\n    on_success_message=None,\n    on_success_message_sql=None,\n    on_success_redirect=None,\n    on_error_message=None,\n    on_error_redirect=None,\n    replace=True,\n): ... \n                     \n                         \n                             database  - string \n                             \n                                 The name of the database this query should belong to. \n                             \n                         \n                         \n                             name  - string \n                             \n                                 The name of the stored query, used in the URL for that query. \n                             \n                         \n                         \n                             sql  - string \n                             \n                                 The SQL for the stored query. \n                             \n                         \n                         \n                             title  - string, optional \n                             \n                                 A display title for the query. \n                             \n                         \n                         \n                             description  - string, optional \n                             \n                                 A plain text description. \n                             \n                         \n                         \n                             description_html  - string, optional \n                             \n                                 An HTML description. \n                             \n                         \n                         \n                             hide_sql  - boolean, optional \n                             \n                                 Set to  True  to hide the SQL by default on the query page. \n                             \n                         \n                         \n                             fragment  - string, optional \n                             \n                                 A URL fragment to append to query links, for example  \"chart\" . \n                             \n                         \n                         \n                             parameters  - list of strings, optional \n                             \n                                 Explicit parameter names for the query form. If omitted, Datasette derives parameters from the SQL. \n                             \n                         \n                         \n                             is_write  - boolean, optional \n                             \n                                 Set to  True  for writable queries. They will the run against the SQLite write connection for the database. \n                             \n                         \n                         \n                             is_private  - boolean, optional \n                             \n                                 Set to  True  for private queries. Private queries can only be viewed, updated or deleted by their owner. \n                             \n                         \n                         \n                             is_trusted  - boolean, optional \n                             \n                                 Set to  True  for  trusted stored queries . \n                             \n                         \n                         \n                             source  - string, optional \n                             \n                                 Identifies where the query came from. Defaults to  \"plugin\" . \n                             \n                         \n                         \n                             owner_id  - string, optional \n                             \n                                 Actor ID of the query owner, used by private query permissions. \n                             \n                         \n                         \n                             on_success_message ,  on_success_message_sql ,  on_success_redirect ,  on_error_message ,  on_error_redirect  - strings, optional \n                             \n                                 Options for  writable queries . \n                             \n                         \n                         \n                             replace  - boolean, optional \n                             \n                                 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. \n                             \n                         \n                     \n                     Example: \n                     await datasette.add_query(\n    database=\"fixtures\",\n    name=\"recent_rows\",\n    sql=\"select * from facetable order by created desc limit 10\",\n    title=\"Recent rows\",\n    source=\"my-plugin\",\n)", "breadcrumbs": "[\"Internals for plugins\", \"Datasette class\", \"Stored queries\"]", "references": "[]"}], "primary_keys": ["id"], "primary_key_values": ["internals:datasette-add-query"], "query_ms": 2.529463992686942, "truncated": false}