{"html_url": "https://github.com/simonw/datasette/issues/1422#issuecomment-893122356", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1422", "id": 893122356, "node_id": "IC_kwDOBm6k_c41O_c0", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-08-05T02:52:31Z", "updated_at": "2021-08-05T02:52:44Z", "author_association": "OWNER", "body": "If you do this it should still be possible to view the SQL - which means we need a new parameter. I propose `?_show_sql=1` to over-ride the hidden default.\r\n\r\nI think the configuration should use `hide_sql: true` - looking like this:\r\n```yaml\r\ndatabases:\r\n fixtures:\r\n queries:\r\n neighborhood_search:\r\n hide_sql: true\r\n sql: |-\r\n select neighborhood, facet_cities.name, state\r\n from facetable\r\n join facet_cities on facetable.city_id = facet_cities.id\r\n where neighborhood like '%' || :text || '%'\r\n order by neighborhood\r\n title: Search neighborhoods\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 961367843, "label": "Ability to default to hiding the SQL for a canned query"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1422#issuecomment-893131703", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1422", "id": 893131703, "node_id": "IC_kwDOBm6k_c41PBu3", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-08-05T03:16:46Z", "updated_at": "2021-08-05T03:16:46Z", "author_association": "OWNER", "body": "The logic for this is a little bit fiddly, due to the need to switch to using `?_show_sql=1` on the link depending on the context.\r\n\r\n- If metadata says hide and there's no query string, hide and link to `?_show_sql=1`\r\n- If metadata says hide but query string says `?_show_sql=1`, show and have hide link linking to URL without `?_show_sql=1`\r\n- Otherwise, show and link to `?_hide_sql=1`\r\n- ... or if that query string is there then hide and link to URL without `?_hide_sql=1`", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 961367843, "label": "Ability to default to hiding the SQL for a canned query"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1422#issuecomment-894589140", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1422", "id": 894589140, "node_id": "IC_kwDOBm6k_c41UljU", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-08-07T01:58:16Z", "updated_at": "2021-08-07T01:58:24Z", "author_association": "OWNER", "body": "Also need to consider this hidden field - it should pass the `_hide_sql` or `_show_sql` parameters depending on the same logic: https://github.com/simonw/datasette/blob/acc22436622ff8476c30acf45ed60f54b4aaa5d9/datasette/templates/query.html#L47-L49", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 961367843, "label": "Ability to default to hiding the SQL for a canned query"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1422#issuecomment-894607989", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1422", "id": 894607989, "node_id": "IC_kwDOBm6k_c41UqJ1", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-08-07T05:31:57Z", "updated_at": "2021-08-07T05:31:57Z", "author_association": "OWNER", "body": "Demo: https://latest.datasette.io/fixtures/neighborhood_search\r\n\r\nDocumentation: https://docs.datasette.io/en/latest/sql_queries.html#additional-canned-query-options", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 961367843, "label": "Ability to default to hiding the SQL for a canned query"}, "performed_via_github_app": null}