{"html_url": "https://github.com/simonw/datasette/issues/1518#issuecomment-993000787", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1518", "id": 993000787, "node_id": "IC_kwDOBm6k_c47L_1T", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-12-13T23:19:20Z", "updated_at": "2021-12-14T17:06:05Z", "author_association": "OWNER", "body": "Useful old comment here: https://github.com/simonw/datasette/issues/617#issuecomment-552253893\r\n\r\n> As noted in [#621 (comment)](https://github.com/simonw/datasette/issues/621#issuecomment-552253208) a common pattern in this method is blocks of code that append new items to the `where_clauses`, `params` and `extra_human_descriptions` arrays. This is a useful refactoring opportunity.\r\n> \r\n> Code that fits this pattern:\r\n> \r\n> * The code that builds based on the filters: `where_clauses, params = filters.build_where_clauses(table)` and `human_description_en = filters.human_description_en(extra=extra_human_descriptions)`\r\n> * Code that handles `?_where=`: `where_clauses.extend(request.args[\"_where\"])` - though note that this also appends to a `extra_wheres_for_ui` array which nothing else uses\r\n> * The `_through=` code, see [Syntax for ?_through= that works as a form field #621](https://github.com/simonw/datasette/issues/621) for details\r\n> * The code that deals with `?_search=` FTS\r\n> \r\n> The keyset pagination code modifies `where_clauses` and `params` too, but I don't think it's quite going to work with the same abstraction that would cover the above examples.\r\n\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1058072543, "label": "Complete refactor of TableView and table.html template"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/526#issuecomment-993078038", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/526", "id": 993078038, "node_id": "IC_kwDOBm6k_c47MSsW", "user": {"value": 536941, "label": "fgregg"}, "created_at": "2021-12-14T01:46:52Z", "updated_at": "2021-12-14T01:46:52Z", "author_association": "CONTRIBUTOR", "body": "the nested query idea is very nice, and i stole if for [my client side paginator](https://observablehq.com/d/1d5da3a3c3f2f347#DatasetteClient). However, it won't do the right thing if the original query orders by random().\r\n\r\nIf you go the nested query route, maybe raise a 4XX status code if the query has such a clause?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 459882902, "label": "Stream all results for arbitrary SQL and canned queries"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1518#issuecomment-993794247", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1518", "id": 993794247, "node_id": "IC_kwDOBm6k_c47PBjH", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-12-14T17:09:40Z", "updated_at": "2021-12-14T17:09:40Z", "author_association": "OWNER", "body": "- `table_actions` should be an extra.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1058072543, "label": "Complete refactor of TableView and table.html template"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/621#issuecomment-993813210", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/621", "id": 993813210, "node_id": "IC_kwDOBm6k_c47PGLa", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-12-14T17:30:13Z", "updated_at": "2021-12-14T20:23:57Z", "author_association": "OWNER", "body": "Might be able to create a web form that's unambiguous using:\r\n\r\n`https://latest.datasette.io/fixtures/roadside_attractions?_through.[\"roadside_attraction_characteristics\",\"characteristic_id\"]=1`\r\n\r\nSo:\r\n\r\n```html\r\n\r\n```\r\nI'm pretty confident this is allowed by the HTML specification. This works:\r\n\r\n```html\r\n
\r\n \r\n \r\n
\r\n```\r\nASGI parsing seems to work too: https://latest-with-plugins.datasette.io/-/asgi-scope?_through.[%22roadside_attraction_characteristics%22%2C%22characteristic_id%22]=1", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 520681725, "label": "Syntax for ?_through= that works as a form field"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1423#issuecomment-993876599", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1423", "id": 993876599, "node_id": "IC_kwDOBm6k_c47PVp3", "user": {"value": 6165713, "label": "plpxsk"}, "created_at": "2021-12-14T18:48:09Z", "updated_at": "2021-12-14T18:48:09Z", "author_association": "NONE", "body": "Great feature.\r\n\r\nBut what is the right way to enable this to show up? Currently, it seems I need to edit the URL to add, in the right place, `&_facet_size=max`\r\n\r\nIs there another (easier) way to enable this feature?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 962391325, "label": "Show count of facet values if ?_facet_size=max"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/621#issuecomment-993958242", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/621", "id": 993958242, "node_id": "IC_kwDOBm6k_c47Ppli", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-12-14T20:33:25Z", "updated_at": "2021-12-14T20:33:56Z", "author_association": "OWNER", "body": "Alternative idea: since current syntax is:\r\n\r\n`?_through={\"table\":\"roadside_attraction_characteristics\",\"column\":\"characteristic_id\",\"value\":\"1\"}`\r\n\r\nThe form-encoding-friendly syntax could be:\r\n\r\n`?_through.{\"table\":\"roadside_attraction_characteristics\",\"column\":\"characteristic_id\"}=1`\r\n\r\nWhich is more consistent than the array proposal:\r\n\r\n`?_through.[\"roadside_attraction_characteristics\",\"characteristic_id\"]=1`", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 520681725, "label": "Syntax for ?_through= that works as a form field"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/621#issuecomment-994005634", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/621", "id": 994005634, "node_id": "IC_kwDOBm6k_c47P1KC", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-12-14T21:02:50Z", "updated_at": "2021-12-14T21:02:50Z", "author_association": "OWNER", "body": "This would also mean that an extra text input box could be easily shown on the page.\r\n\r\nhttps://latest-with-plugins.datasette.io/fixtures/roadside_attractions?_through={\"table\":\"roadside_attraction_characteristics\",\"column\":\"characteristic_id\",\"value\":\"1\"} but with the annotated box added (and made to look good):\r\n\r\n\"image\"\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 520681725, "label": "Syntax for ?_through= that works as a form field"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1518#issuecomment-994042389", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1518", "id": 994042389, "node_id": "IC_kwDOBm6k_c47P-IV", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-12-14T21:35:53Z", "updated_at": "2021-12-14T21:35:53Z", "author_association": "OWNER", "body": "Maybe a better way to approach this would be to focus on the JSON side of things - try to get a basic JSON version with `?_extra=` support working, then eventually build that up to the point where it can power the HTML version.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1058072543, "label": "Complete refactor of TableView and table.html template"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1518#issuecomment-994085710", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1518", "id": 994085710, "node_id": "IC_kwDOBm6k_c47QItO", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-12-14T22:03:16Z", "updated_at": "2021-12-14T22:04:28Z", "author_association": "OWNER", "body": "There are actually four forms of SQL query used by the table page:\r\n\r\n- `from_sql` - just the `from table_name where ...`\r\n- `sql_no_order_no_limit` - used for faceting, `\"select {select_all_columns} from {table_name} {where}\"`\r\n- `sql` - the above but with order and limit clauses: `\"select {select_specified_columns} from {table_name} {where}{order_by} limit {page_size}{offset}\"`\r\n- `count_sql` used for the count, built out of `from_sql`: `\"select count(*) {from_sql}\"`\r\n\r\nI'm tempted to encapsulate those in a `Query` class.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1058072543, "label": "Complete refactor of TableView and table.html template"}, "performed_via_github_app": null}