home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where author_association = "OWNER", issue = 1058072543 and "updated_at" is on date 2021-12-14 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 4

issue 1

  • Complete refactor of TableView and table.html template · 4 ✖

author_association 1

  • OWNER · 4 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
994085710 https://github.com/simonw/datasette/issues/1518#issuecomment-994085710 https://api.github.com/repos/simonw/datasette/issues/1518 IC_kwDOBm6k_c47QItO simonw 9599 2021-12-14T22:03:16Z 2021-12-14T22:04:28Z OWNER

There are actually four forms of SQL query used by the table page:

  • from_sql - just the from table_name where ...
  • sql_no_order_no_limit - used for faceting, "select {select_all_columns} from {table_name} {where}"
  • sql - the above but with order and limit clauses: "select {select_specified_columns} from {table_name} {where}{order_by} limit {page_size}{offset}"
  • count_sql used for the count, built out of from_sql: "select count(*) {from_sql}"

I'm tempted to encapsulate those in a Query class.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Complete refactor of TableView and table.html template 1058072543  
994042389 https://github.com/simonw/datasette/issues/1518#issuecomment-994042389 https://api.github.com/repos/simonw/datasette/issues/1518 IC_kwDOBm6k_c47P-IV simonw 9599 2021-12-14T21:35:53Z 2021-12-14T21:35:53Z OWNER

Maybe a better way to approach this would be to focus on the JSON side of things - try to get a basic JSON version with ?_extra= support working, then eventually build that up to the point where it can power the HTML version.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Complete refactor of TableView and table.html template 1058072543  
993794247 https://github.com/simonw/datasette/issues/1518#issuecomment-993794247 https://api.github.com/repos/simonw/datasette/issues/1518 IC_kwDOBm6k_c47PBjH simonw 9599 2021-12-14T17:09:40Z 2021-12-14T17:09:40Z OWNER
  • table_actions should be an extra.
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Complete refactor of TableView and table.html template 1058072543  
993000787 https://github.com/simonw/datasette/issues/1518#issuecomment-993000787 https://api.github.com/repos/simonw/datasette/issues/1518 IC_kwDOBm6k_c47L_1T simonw 9599 2021-12-13T23:19:20Z 2021-12-14T17:06:05Z OWNER

Useful old comment here: https://github.com/simonw/datasette/issues/617#issuecomment-552253893

As noted in #621 (comment) a common pattern in this method is blocks of code that append new items to the where_clauses, params and extra_human_descriptions arrays. This is a useful refactoring opportunity.

Code that fits this pattern:

  • The code that builds based on the filters: where_clauses, params = filters.build_where_clauses(table) and human_description_en = filters.human_description_en(extra=extra_human_descriptions)
  • Code that handles ?_where=: where_clauses.extend(request.args["_where"]) - though note that this also appends to a extra_wheres_for_ui array which nothing else uses
  • The _through= code, see Syntax for ?_through= that works as a form field #621 for details
  • The code that deals with ?_search= FTS

The keyset pagination code modifies where_clauses and params too, but I don't think it's quite going to work with the same abstraction that would cover the above examples.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Complete refactor of TableView and table.html template 1058072543  

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.528ms · About: github-to-sqlite