github
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/sqlite-utils/issues/79#issuecomment-1029703503 | https://api.github.com/repos/simonw/sqlite-utils/issues/79 | 1029703503 | IC_kwDOCGYnMM49YAdP | 9599 | 2022-02-04T06:46:32Z | 2022-02-04T06:46:32Z | OWNER | Shipped in 3.23: https://sqlite-utils.datasette.io/en/stable/changelog.html#v3-23 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
557842245 | |
https://github.com/simonw/sqlite-utils/pull/385#issuecomment-1029703216 | https://api.github.com/repos/simonw/sqlite-utils/issues/385 | 1029703216 | IC_kwDOCGYnMM49YAYw | 9599 | 2022-02-04T06:45:43Z | 2022-02-04T06:45:43Z | OWNER | Shipped this as `sqlite-utils` 3.23: https://sqlite-utils.datasette.io/en/stable/changelog.html#v3-23 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1102899312 | |
https://github.com/simonw/datasette/issues/1080#issuecomment-1029695083 | https://api.github.com/repos/simonw/datasette/issues/1080 | 1029695083 | IC_kwDOBm6k_c49X-Zr | 9599 | 2022-02-04T06:24:40Z | 2022-02-04T06:25:18Z | OWNER | An initial prototype of that in my local `group-count` branch quickly started running into problems: ```diff diff --git a/datasette/views/table.py b/datasette/views/table.py index be9e9c3..d30efe1 100644 --- a/datasette/views/table.py +++ b/datasette/views/table.py @@ -105,8 +105,12 @@ class RowTableShared(DataView): type_ = "integer" notnull = 0 else: - type_ = column_details[r[0]].type - notnull = column_details[r[0]].notnull + try: + type_ = column_details[r[0]].type + notnull = column_details[r[0]].notnull + except KeyError: # Probably count(*) + type_ = "integer" + notnull = False columns.append( { "name": r[0], @@ -613,6 +617,15 @@ class TableView(RowTableShared): offset=offset, ) + # If ?_group_count we convert the SQL query here + group_count = request.args.getlist("_group_count") + if group_count: + wrapped_sql = "select {cols}, count(*) from ({sql}) group by {cols}".format( + cols=", ".join(group_count), + sql=sql, + ) + sql = wrapped_sql + if request.args.get("_timelimit"): extra_args["custom_time_limit"] = int(request.args.get("_timelimit")) ``` Resulted in errors like this one: ``` pk_path = path_from_row_pks(row, pks, not pks, False) File "/Users/simon/Dropbox/Development/datasette/datasette/utils/__init__.py", line 82, in path_from_row_pks bits = [ File "/Users/simon/Dropbox/Development/datasette/datasette/utils/__init__.py", line 83, in <listcomp> row[pk]["value"] if isinstance(row[pk], dict) else row[pk] for pk in pks IndexError: No item with that key ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
734777631 | |
https://github.com/simonw/datasette/issues/1080#issuecomment-1029691693 | https://api.github.com/repos/simonw/datasette/issues/1080 | 1029691693 | IC_kwDOBm6k_c49X9kt | 9599 | 2022-02-04T06:16:45Z | 2022-02-04T06:16:45Z | OWNER | Had a new, different idea for how this could work: support a `?_group_count=colname` parameter to the table view, which turns the page into a `select colname, count(*) ... group by colname` query - but keeps things like the filter interface, facet selection, search box and so on. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
734777631 | |
https://github.com/simonw/sqlite-utils/issues/395#issuecomment-1029686150 | https://api.github.com/repos/simonw/sqlite-utils/issues/395 | 1029686150 | IC_kwDOCGYnMM49X8OG | 9599 | 2022-02-04T06:03:51Z | 2022-02-04T06:03:51Z | OWNER | I'm just going to run the SpatiaLite tests on Ubuntu. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1123849278 | |
https://github.com/simonw/sqlite-utils/issues/79#issuecomment-1029683977 | https://api.github.com/repos/simonw/sqlite-utils/issues/79 | 1029683977 | IC_kwDOCGYnMM49X7sJ | 9599 | 2022-02-04T05:58:15Z | 2022-02-04T05:58:15Z | OWNER | Documentation: https://sqlite-utils.datasette.io/en/latest/python-api.html#spatialite-helpers | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
557842245 | |
https://github.com/simonw/sqlite-utils/pull/385#issuecomment-1029682294 | https://api.github.com/repos/simonw/sqlite-utils/issues/385 | 1029682294 | IC_kwDOCGYnMM49X7R2 | 9599 | 2022-02-04T05:53:26Z | 2022-02-04T05:53:26Z | OWNER | This looks fantastic, thanks for all of the work you put into this! | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1102899312 |