issue_comments
12 rows where "created_at" is on date 2023-03-08, issue = 1615692818 and user = 9599 sorted by updated_at descending
This data as json, CSV (advanced)
Suggested facets: updated_at (date)
issue 1
- Potential feature: special support for `?a=1&a=2` on the query page · 12 ✖
id | html_url | issue_url | node_id | user | created_at | updated_at ▲ | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
1460682625 | https://github.com/simonw/datasette/issues/2035#issuecomment-1460682625 | https://api.github.com/repos/simonw/datasette/issues/2035 | IC_kwDOBm6k_c5XED-B | simonw 9599 | 2023-03-08T18:40:57Z | 2023-03-08T18:40:57Z | OWNER | Pushed that prototype to a branch: https://github.com/simonw/datasette/commit/0fe844e9adb006a0138e83102ced1329d9155c59 / https://github.com/simonw/datasette/compare/sql-list-parameters |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Potential feature: special support for `?a=1&a=2` on the query page 1615692818 | |
1460679434 | https://github.com/simonw/datasette/issues/2035#issuecomment-1460679434 | https://api.github.com/repos/simonw/datasette/issues/2035 | IC_kwDOBm6k_c5XEDMK | simonw 9599 | 2023-03-08T18:39:35Z | 2023-03-08T18:39:35Z | OWNER | I should consider the existing design of magic parameters here: https://docs.datasette.io/en/stable/sql_queries.html#magic-parameters
Should this new |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Potential feature: special support for `?a=1&a=2` on the query page 1615692818 | |
1460668431 | https://github.com/simonw/datasette/issues/2035#issuecomment-1460668431 | https://api.github.com/repos/simonw/datasette/issues/2035 | IC_kwDOBm6k_c5XEAgP | simonw 9599 | 2023-03-08T18:35:34Z | 2023-03-08T18:35:34Z | OWNER | To implement this properly need to do the following:
- Get the page to display multiple And a bonus feature: what if the Datasette UI layer spotted Also, when a page is re-displayed for on of these queries it could potentially add an extra form field allowing people to add another value. Though this has an annoying problem: how to tell the difference between an additional Maybe only support multiple |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Potential feature: special support for `?a=1&a=2` on the query page 1615692818 | |
1460664619 | https://github.com/simonw/datasette/issues/2035#issuecomment-1460664619 | https://api.github.com/repos/simonw/datasette/issues/2035 | IC_kwDOBm6k_c5XD_kr | simonw 9599 | 2023-03-08T18:32:29Z | 2023-03-08T18:32:29Z | OWNER | Got a prototype working: ```diff diff --git a/datasette/views/database.py b/datasette/views/database.py index 8d289105..6f9d8a44 100644 --- a/datasette/views/database.py +++ b/datasette/views/database.py @@ -226,6 +226,12 @@ class QueryView(DataView): ): db = await self.ds.resolve_database(request) database = db.name + # Disallow x__list query string parameters + invalid_params = [k for k in request.args if k.endswith("__list")] + if invalid_params: + raise DatasetteError( + "Invalid query string parameters: {}".format(", ".join(invalid_params)) + ) params = {key: request.args.get(key) for key in request.args} if "sql" in params: params.pop("sql") @@ -258,6 +264,11 @@ class QueryView(DataView): for named_parameter in named_parameters if not named_parameter.startswith("_") } + # Handle any __list parameters + for named_parameter in named_parameters: + if named_parameter.endswith("__list"): + list_values = request.args.getlist(named_parameter[:-6]) + params[named_parameter] = json.dumps(list_values)
That was this URL: |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Potential feature: special support for `?a=1&a=2` on the query page 1615692818 | |
1460659382 | https://github.com/simonw/datasette/issues/2035#issuecomment-1460659382 | https://api.github.com/repos/simonw/datasette/issues/2035 | IC_kwDOBm6k_c5XD-S2 | simonw 9599 | 2023-03-08T18:28:00Z | 2023-03-08T18:28:00Z | OWNER | Also:
|
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Potential feature: special support for `?a=1&a=2` on the query page 1615692818 | |
1460654136 | https://github.com/simonw/datasette/issues/2035#issuecomment-1460654136 | https://api.github.com/repos/simonw/datasette/issues/2035 | IC_kwDOBm6k_c5XD9A4 | simonw 9599 | 2023-03-08T18:25:46Z | 2023-03-08T18:25:46Z | OWNER | Trickiest part of the implementation here is that it needs to know to output three |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Potential feature: special support for `?a=1&a=2` on the query page 1615692818 | |
1460639749 | https://github.com/simonw/datasette/issues/2035#issuecomment-1460639749 | https://api.github.com/repos/simonw/datasette/issues/2035 | IC_kwDOBm6k_c5XD5gF | simonw 9599 | 2023-03-08T18:17:31Z | 2023-03-08T18:17:31Z | OWNER | Since we are pre-1.0 it's still OK to implement a feature that disallows So I'm going to prototype this as the |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Potential feature: special support for `?a=1&a=2` on the query page 1615692818 | |
1460637906 | https://github.com/simonw/datasette/issues/2035#issuecomment-1460637906 | https://api.github.com/repos/simonw/datasette/issues/2035 | IC_kwDOBm6k_c5XD5DS | simonw 9599 | 2023-03-08T18:16:31Z | 2023-03-08T18:16:31Z | OWNER | I'm pretty sold on this as a feature now. The main question I have is which of these options to implement:
Actually on writing these out I realize that option 2 is the ONLY valid option. It's no good building a query that works against a JSON list if the user might pass just a single ID, |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Potential feature: special support for `?a=1&a=2` on the query page 1615692818 | |
1460632758 | https://github.com/simonw/datasette/issues/2035#issuecomment-1460632758 | https://api.github.com/repos/simonw/datasette/issues/2035 | IC_kwDOBm6k_c5XD3y2 | simonw 9599 | 2023-03-08T18:13:49Z | 2023-03-08T18:13:49Z | OWNER | https://github.com/rclement/datasette-dashboards/issues/54 makes the excellent point that the ```html <form action="https://www.example.com/"> <select multiple name="id"> <option>21</option> <option>32</option> <option>15</option> <option>63</option> </select> </form>
|
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Potential feature: special support for `?a=1&a=2` on the query page 1615692818 | |
1460628199 | https://github.com/simonw/datasette/issues/2035#issuecomment-1460628199 | https://api.github.com/repos/simonw/datasette/issues/2035 | IC_kwDOBm6k_c5XD2rn | simonw 9599 | 2023-03-08T18:11:31Z | 2023-03-08T18:11:31Z | OWNER | One variant on this idea: maybe you have to specify in your query that you want it to be the JSON list version, not the single item (first
Datasette would automatically pass This is more explicit, though the syntax is a bit uglier (maybe there's a nicer design for this?). I also worry about |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Potential feature: special support for `?a=1&a=2` on the query page 1615692818 | |
1460621871 | https://github.com/simonw/datasette/issues/2035#issuecomment-1460621871 | https://api.github.com/repos/simonw/datasette/issues/2035 | IC_kwDOBm6k_c5XD1Iv | simonw 9599 | 2023-03-08T18:08:25Z | 2023-03-08T18:09:04Z | OWNER | My current preferred solution is to lean into SQLite's JSON support. What if the query page spotted Note that this is still a string, not a list. This avoids a nasty problem that occurred in PHP world, where So in a query you'd be able to do this:
And then call it with |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Potential feature: special support for `?a=1&a=2` on the query page 1615692818 | |
1460618433 | https://github.com/simonw/datasette/issues/2035#issuecomment-1460618433 | https://api.github.com/repos/simonw/datasette/issues/2035 | IC_kwDOBm6k_c5XD0TB | simonw 9599 | 2023-03-08T18:06:34Z | 2023-03-08T18:06:34Z | OWNER | One way to do this would be to dynamically generate the |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
Potential feature: special support for `?a=1&a=2` on the query page 1615692818 |
Advanced export
JSON shape: default, array, newline-delimited, object
CREATE TABLE [issue_comments] ( [html_url] TEXT, [issue_url] TEXT, [id] INTEGER PRIMARY KEY, [node_id] TEXT, [user] INTEGER REFERENCES [users]([id]), [created_at] TEXT, [updated_at] TEXT, [author_association] TEXT, [body] TEXT, [reactions] TEXT, [issue] INTEGER REFERENCES [issues]([id]) , [performed_via_github_app] TEXT); CREATE INDEX [idx_issue_comments_issue] ON [issue_comments] ([issue]); CREATE INDEX [idx_issue_comments_user] ON [issue_comments] ([user]);
user 1