html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,issue,performed_via_github_app https://github.com/simonw/datasette/issues/2049#issuecomment-1498275621,https://api.github.com/repos/simonw/datasette/issues/2049,1498275621,IC_kwDOBm6k_c5ZTd8l,9599,2023-04-05T23:23:01Z,2023-04-05T23:23:01Z,OWNER,"The default representation here can be even smaller. For rows it's this: ```json { ""ok"": true, ""next"": ""d,v"", ""rows"": [...] } ``` For SQL queries I'm considering this: ```json { ""ok"": true, ""rows"": [...] } ``` I considered adding `""sql""` and `""params""` too, but on further thought those would be entirely a waste of bytes the majority of the time. If a user wants those they can request them with an `?_extra=query` as seen here: http://localhost:8001/content/releases.json?_size=0&_extra=query ```json { ""ok"": true, ""next"": null, ""query"": { ""sql"": ""select html_url, id, author, node_id, tag_name, target_commitish, name, draft, prerelease, created_at, published_at, body, repo, reactions, mentions_count from releases order by id limit 1"", ""params"": {} }, ""rows"": [] } ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1646734246, https://github.com/simonw/datasette/issues/2049#issuecomment-1489530555,https://api.github.com/repos/simonw/datasette/issues/2049,1489530555,IC_kwDOBm6k_c5YyG67,9599,2023-03-30T00:51:27Z,2023-03-30T00:51:27Z,OWNER,"I'd really like to refactor all of the extras functions into a `datasette/extras.py` module. The table ones currently rely a LOT on local variables in scope though, so I would need to rewrite those such that EVERY dependency they take is passed to `asyncinject` explicitly.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1646734246, https://github.com/simonw/datasette/issues/2049#issuecomment-1489530037,https://api.github.com/repos/simonw/datasette/issues/2049,1489530037,IC_kwDOBm6k_c5YyGy1,9599,2023-03-30T00:50:30Z,2023-03-30T00:50:30Z,OWNER,"Two things to consider here: `_shape=` and `_extra=`. Most of the shapes make sense, with the exception of `?_shape=object` since we don't know which column we would use as a primary key. Looking at the (undocumented) list of extras from the table view, here are the ones I think make sense: - `count` - YES - `facet_results` - no - `facets_timed_out` - no - `suggested_facets` - no - `human_description_en` - no - `next_url` - MAYBE - `columns` - YES - `primary_keys` - no - `display_columns` - YES - `display_rows` - YES - `debug` - YES? - `request` - YES - `query` - YES - `metadata` - YES - `extras` - YES - `database` - YES - `table` - no - `database_color` - no? - `table_actions` - no - `filters` - no - `renderers` - YES - `custom_table_templates` - no - `sorted_facet_results` - no - `table_definition` - no - `view_definition` - no - `is_view` - no - `private` - YES - `expandable_columns` - no - `form_hidden_args` - no Just the YES ones: - `count` - this is new - `columns` - `display_columns` - `display_rows` - `debug` - `request` - `query` - `metadata` - `extras` - `database` - `renderers` - `private` The `count` one is interesting - I think I can provide that by optionally running `select count(*) from (inner query)`. It's a new feature though and not one I want to expose on the HTML view since it could result in poor performance - but having it as an extra that API users can opt into may make sense.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1646734246, https://github.com/simonw/datasette/issues/2049#issuecomment-1489526501,https://api.github.com/repos/simonw/datasette/issues/2049,1489526501,IC_kwDOBm6k_c5YyF7l,9599,2023-03-30T00:44:05Z,2023-03-30T00:44:05Z,OWNER,"As part of this I should be able to figure out which bits of the new code I wrote for the table view should actually be shared with the query view. That stuff is mostly going to be from this commit: https://github.com/simonw/datasette/commit/d97e82df3c8a3f2e97038d7080167be9bb74a68d Here's the existing QueryView class I need to replace: https://github.com/simonw/datasette/blob/4c1e277edbd783d06840d3f9b20bf00783478ce4/datasette/views/database.py#L215-L532","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1646734246,