home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where issue = 640917326 and "updated_at" is on date 2020-06-18 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

  • canned_queries() plugin hook · 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
646350530 https://github.com/simonw/datasette/issues/852#issuecomment-646350530 https://api.github.com/repos/simonw/datasette/issues/852 MDEyOklzc3VlQ29tbWVudDY0NjM1MDUzMA== simonw 9599 2020-06-18T23:13:57Z 2020-06-18T23:14:11Z OWNER

python @hookspec def canned_queries(datasette, database, actor): "Return a dictionary of canned query definitions or an awaitable function that returns them"

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
canned_queries() plugin hook 640917326  
646329456 https://github.com/simonw/datasette/issues/852#issuecomment-646329456 https://api.github.com/repos/simonw/datasette/issues/852 MDEyOklzc3VlQ29tbWVudDY0NjMyOTQ1Ng== simonw 9599 2020-06-18T22:07:09Z 2020-06-18T22:07:37Z OWNER

It would be neat if the queries returned by this hook could be restricted to specific users. I think I can do that by returning an "allow" block as part of the query.

But... what if we allow users to save private queries and we might have thousands of users each with hundreds of saved queries?

For that case it would be good if the plugin hook could take an optional actor parameter.

This would also allow us to dynamically generate a canned query for "return the bookmarks belonging to this actor" or similar!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
canned_queries() plugin hook 640917326  
645785830 https://github.com/simonw/datasette/issues/852#issuecomment-645785830 https://api.github.com/repos/simonw/datasette/issues/852 MDEyOklzc3VlQ29tbWVudDY0NTc4NTgzMA== simonw 9599 2020-06-18T05:37:00Z 2020-06-18T05:37:00Z OWNER

The easiest way to do this would be with a new plugin hook:

def canned_queries(datasette, database):
    """Return a list of canned query definitions
    or an awaitable function that returns them"

Another approach would be to make the whole of metadata.json customizable by plugins.

I think I like the dedicated canned_queries option better. I'm not happy with the way metadata keeps growing - see #493 - so adding a dedicated hook would be more future proof against other changes I might make to the metadata mechanism.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
canned_queries() plugin hook 640917326  
645781482 https://github.com/simonw/datasette/issues/852#issuecomment-645781482 https://api.github.com/repos/simonw/datasette/issues/852 MDEyOklzc3VlQ29tbWVudDY0NTc4MTQ4Mg== simonw 9599 2020-06-18T05:24:55Z 2020-06-18T05:25:00Z OWNER

Question about this on Twitter: https://twitter.com/amjithr/status/1273440766862352384

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
canned_queries() plugin hook 640917326  

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 25.92ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows