home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

1 row where author_association = "OWNER", "created_at" is on date 2018-09-21 and issue = 326800219 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 1

issue 1

  • Mechanism for customizing the SQL used to select specific columns in the table view · 1 ✖

author_association 1

  • OWNER · 1 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
423543060 https://github.com/simonw/datasette/issues/292#issuecomment-423543060 https://api.github.com/repos/simonw/datasette/issues/292 MDEyOklzc3VlQ29tbWVudDQyMzU0MzA2MA== simonw 9599 2018-09-21T14:06:31Z 2018-09-21T14:09:06Z OWNER

I keep on finding new reasons that I want this.

The latest is that I'm playing with the more advanced features of FTS5 - in particular the highlight() function and the ability to sort by rank.

The problem is... in order to do this, I need to properly join against the _fts table. Here's an example query:

select
  highlight(events_fts, 0, '<b>', '</b>'),
  events_fts.rank,
  events.*
from events
  join events_fts on events.rowid = events_fts.rowid
where events_fts match :search 
order by rank

Note that this is a different query from the usual FTS one (which does where rowid in (select rowid from events_fts...)) because I need the rank column somewhere I can sort against.

I'd like to be able to use this on the table view page so I can get faceting etc for free, but this is a completely different query from the default. Maybe I need a way to customize the entire query? That feels weird though - why am I not using a view in that case?

Answer: because views can't accept :search style parameters. I could use a canned query, but canned queries don't get faceting etc.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Mechanism for customizing the SQL used to select specific columns in the table view 326800219  

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