{"html_url": "https://github.com/simonw/datasette/issues/262#issuecomment-712988146", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/262", "id": 712988146, "node_id": "MDEyOklzc3VlQ29tbWVudDcxMjk4ODE0Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-20T16:32:02Z", "updated_at": "2023-01-17T01:54:13Z", "author_association": "OWNER", "body": "Just realized I added an undocumented `?_extras=` option to the row view years ago and forgot about it - it's not even documented. Added in a30c5b220c15360d575e94b0e67f3255e120b916 - https://latest.datasette.io/fixtures/attraction_characteristic/2.json?_extras=foreign_key_tables\r\n\r\nThat will need to be made consistent with the new mechanism. I think `?_extra=a&_extra=b` is more consistent with other Datasette features (like `?_facet=col1&_facet=col2`) but potentially quite verbose.\r\n\r\nSo I could support `?_extra=a,b,c` as an alternative allowed syntax, or I could allow `?_extra=single` and `?_extras=comma,separated`.\r\n\r\nI think I prefer allowing commas in `?_extra=`.\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 323658641, "label": "Add ?_extra= mechanism for requesting extra properties in JSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/262#issuecomment-1384741055", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/262", "id": 1384741055, "node_id": "IC_kwDOBm6k_c5SiXi_", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-01-17T01:58:24Z", "updated_at": "2023-01-17T01:58:24Z", "author_association": "OWNER", "body": "As suggested in this issue:\r\n- #1721 \r\n\r\nThere are three parts of the Datasette API that need to support extras:\r\n\r\n- Table, e.g. https://latest.datasette.io/fixtures/facetable.json\r\n- Row, e.g. https://latest.datasette.io/fixtures/facetable/1.json\r\n- Query, e.g. https://latest.datasette.io/fixtures/neighborhood_search.json or https://latest.datasette.io/fixtures.json?sql=%0Aselect+_neighborhood%2C+facet_cities.name%2C+state%0Afrom+facetable%0A++++join+facet_cities%0A++++++++on+facetable._city_id+%3D+facet_cities.id%0Awhere+_neighborhood+like+%27%25%27+||+%3Atext+||+%27%25%27%0Aorder+by+_neighborhood%3B%0A&text=\r\n\r\nThere are two other pages I should consider though:\r\n\r\n- https://latest.datasette.io/.json - the JSON version of the https://latest.datasette.io/ homepage\r\n- https://latest.datasette.io/fixtures.json - note that this is different from the same URL with `?sql=...` appended to it. This is the index of tables in a specific database", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 323658641, "label": "Add ?_extra= mechanism for requesting extra properties in JSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/262#issuecomment-1384742385", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/262", "id": 1384742385, "node_id": "IC_kwDOBm6k_c5SiX3x", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-01-17T02:00:23Z", "updated_at": "2023-01-17T02:00:38Z", "author_association": "OWNER", "body": "I'm not actually too happy about how `/fixtures.json` currently entirely changes shape based on whether or not you pass a `?sql=` argument to it.\r\n\r\nMaybe I can fix that disparity with extras too?\r\n\r\nThe list of tables you see on `/fixtures.json` without the `?sql=` could become another extra. The HTML version of that page could know to request that extra by default.\r\n\r\nThis would also support running a SQL query but also returning a list of tables - which can be useful for building a SQL editor interface which hints at the tables that are available to the user - or even for generating the configuration needed by the CodeMirror editor's SQL completion, added in:\r\n- #1893", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 323658641, "label": "Add ?_extra= mechanism for requesting extra properties in JSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/262#issuecomment-1384743243", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/262", "id": 1384743243, "node_id": "IC_kwDOBm6k_c5SiYFL", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-01-17T02:01:26Z", "updated_at": "2023-01-17T02:01:26Z", "author_association": "OWNER", "body": "I'm tempted NOT to document the JSON for the `/.json` page, simply because I'm not at all convinced that the current homepage design is the best possible use of that space - and I'd like to reserve the opportunity to redesign that in e.g. Datasette 1.1 without it being a breaking change to the documented JSON API.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 323658641, "label": "Add ?_extra= mechanism for requesting extra properties in JSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/262#issuecomment-1384752452", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/262", "id": 1384752452, "node_id": "IC_kwDOBm6k_c5SiaVE", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-01-17T02:14:41Z", "updated_at": "2023-01-17T02:15:58Z", "author_association": "OWNER", "body": "Thinking about `?_extra=` values just for the table JSON. The default shape will look like this:\r\n\r\n```json\r\n{\r\n \"ok\": true,\r\n \"rows\": [{\"id\": 1, \"name\": \"Name\"}],\r\n \"next\": null,\r\n}\r\n```\r\nThe table extras could be:\r\n\r\n- `count` - adds a `\"count\"` field with a full `count(*)` for that filtered table\r\n- `next_url` - the full URL to the next page\r\n- `columns` - adds `\"columns\": [\"id\", \"name\"]`\r\n- `expandable_columns` - a list of columns that can be expanded (note that `\"expanded_columns\": [...]` shows up automatically if the user passes any `?_label=` options, like on https://latest.datasette.io/fixtures/facetable.json?_label=_city_id ) - I'm tempted to rename this to `label_columns` and have it add both `label_columns` and `label_columns_selected` or similar.\r\n- `primary_keys` - a list of primary keys e.g. `[\"id\"]` - not sure what to do about `rowid` columns here\r\n- `query` - a `{\"sql\": \"select ...\", \"params\": {\"p0\": \"1\"}}` object\r\n- `units` - the units feature\r\n- `suggested_facets` - suggested facets\r\n- `metadata` - a `{\"metadata\": {\"source_url\": \"...\"}}` etc block - differs from current in that it would be nested in `\"metadata\": {...}`.\r\n\r\nStuff currently in https://latest.datasette.io/fixtures/facetable.json that is not yet covered by the above:\r\n```\r\n \"database\": \"fixtures\",\r\n \"table\": \"facetable\",\r\n \"is_view\": false,\r\n \"human_description_en\": \"where id = 1\",\r\n \"private\": false,\r\n \"allow_execute_sql\": true,\r\n \"query_ms\": 16.749476999393664,\r\n```\r\nI'm tempted to bundle `database`, `table`, `is_view` and `human_description_en` into one (not sure what to call it though, perhaps `display_details`?) - and then drop `allow_execute_sql` entirely and have `private` and `query_ms` as their own named extras.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 323658641, "label": "Add ?_extra= mechanism for requesting extra properties in JSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/262#issuecomment-1385805702", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/262", "id": 1385805702, "node_id": "IC_kwDOBm6k_c5SmbeG", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-01-17T17:50:17Z", "updated_at": "2023-01-17T17:50:17Z", "author_association": "OWNER", "body": "Or maybe have a `permissions` extra which includes `allow_execute_sql` and `private`? Could anything else go in there?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 323658641, "label": "Add ?_extra= mechanism for requesting extra properties in JSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/782#issuecomment-1368269732", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/782", "id": 1368269732, "node_id": "IC_kwDOBm6k_c5RjiOk", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-31T19:32:33Z", "updated_at": "2023-01-17T02:05:45Z", "author_association": "OWNER", "body": "New thinking on the trimmed-down default. Previously I was going to use `\"row\"` and `\"next_url\"` - I now want to do this instead:\r\n```json\r\n{\r\n \"ok\": true,\r\n \"rows\": [\r\n {\r\n \"pk1\": \"a\",\r\n \"pk2\": \"a\",\r\n \"pk3\": \"a\",\r\n \"content\": \"a-a-a\"\r\n },\r\n {\r\n \"pk1\": \"a\",\r\n \"pk2\": \"a\",\r\n \"pk3\": \"b\",\r\n \"content\": \"a-a-b\"\r\n }\r\n ],\r\n \"next\": \"a,a,b\"\r\n}\r\n```\r\nIf there isn't a next page it will return `\"next\": null`.\r\n\r\nThis is even more succinct. I'm OK with people having to request `next_url` if they don't want to construct the new URL themselves.\r\n\r\nThe `\"ok\": true` is there so it can be `false` for errors, consistently.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 627794879, "label": "Redesign default .json format"}, "performed_via_github_app": null}