home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

7 rows where author_association = "OWNER" and issue = 734777631 sorted by updated_at descending

✖
✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 1

  • simonw 7

issue 1

  • "View all" option for facets, to provide a (paginated) list of ALL of the facet counts plus a link to view them · 7 ✖

author_association 1

  • OWNER · 7 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
1029695083 https://github.com/simonw/datasette/issues/1080#issuecomment-1029695083 https://api.github.com/repos/simonw/datasette/issues/1080 IC_kwDOBm6k_c49X-Zr simonw 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
}
"View all" option for facets, to provide a (paginated) list of ALL of the facet counts plus a link to view them 734777631  
1029691693 https://github.com/simonw/datasette/issues/1080#issuecomment-1029691693 https://api.github.com/repos/simonw/datasette/issues/1080 IC_kwDOBm6k_c49X9kt simonw 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
}
"View all" option for facets, to provide a (paginated) list of ALL of the facet counts plus a link to view them 734777631  
720696827 https://github.com/simonw/datasette/issues/1080#issuecomment-720696827 https://api.github.com/repos/simonw/datasette/issues/1080 MDEyOklzc3VlQ29tbWVudDcyMDY5NjgyNw== simonw 9599 2020-11-02T20:08:49Z 2020-11-02T20:13:56Z OWNER

Implementing pagination for facets will be interesting. Would be easier if I had a nicer reusable internal pagination mechanism, which is also needed for #856 (pagination of canned queries).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
"View all" option for facets, to provide a (paginated) list of ALL of the facet counts plus a link to view them 734777631  
720699160 https://github.com/simonw/datasette/issues/1080#issuecomment-720699160 https://api.github.com/repos/simonw/datasette/issues/1080 MDEyOklzc3VlQ29tbWVudDcyMDY5OTE2MA== simonw 9599 2020-11-02T20:13:42Z 2020-11-02T20:13:42Z OWNER

Also relevant to this issue: #830 - redesigning the facet plugin hook in preparation for Datasette 1.0. And #972 supporting faceting against arbitrary queries.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
"View all" option for facets, to provide a (paginated) list of ALL of the facet counts plus a link to view them 734777631  
720698577 https://github.com/simonw/datasette/issues/1080#issuecomment-720698577 https://api.github.com/repos/simonw/datasette/issues/1080 MDEyOklzc3VlQ29tbWVudDcyMDY5ODU3Nw== simonw 9599 2020-11-02T20:12:26Z 2020-11-02T20:12:26Z OWNER

For regular column faceting, here's the query that is used:

https://github.com/simonw/datasette/blob/13d1228d80c91d382a05b1a9549ed02c300ef851/datasette/facets.py#L196-L204

Since it uses order by count desc, value maybe those values could be used to implement cursor-based pagination.

That wouldn't be robust in the face of changing data, but I'm not sure it's possible to implement paginated faceting in a way that survives ongoing changes to the underlying data.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
"View all" option for facets, to provide a (paginated) list of ALL of the facet counts plus a link to view them 734777631  
720697226 https://github.com/simonw/datasette/issues/1080#issuecomment-720697226 https://api.github.com/repos/simonw/datasette/issues/1080 MDEyOklzc3VlQ29tbWVudDcyMDY5NzIyNg== simonw 9599 2020-11-02T20:09:38Z 2020-11-02T20:09:38Z OWNER

Maybe this ends up being code that defers to a simulated canned query, rendered using the existing query.html template.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
"View all" option for facets, to provide a (paginated) list of ALL of the facet counts plus a link to view them 734777631  
720695174 https://github.com/simonw/datasette/issues/1080#issuecomment-720695174 https://api.github.com/repos/simonw/datasette/issues/1080 MDEyOklzc3VlQ29tbWVudDcyMDY5NTE3NA== simonw 9599 2020-11-02T20:05:26Z 2020-11-02T20:05:26Z OWNER

URL design:

/database/table/-/facet/colname

And for other types of facet (to be supported later):

/database/table/-/facet/colname?_type=m2m

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
"View all" option for facets, to provide a (paginated) list of ALL of the facet counts plus a link to view them 734777631  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

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]);
Powered by Datasette · Queries took 15.34ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows