home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where issue = 1646734246 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

  • Custom SQL queries should use new JSON ?_extra= format · 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
1498275621 https://github.com/simonw/datasette/issues/2049#issuecomment-1498275621 https://api.github.com/repos/simonw/datasette/issues/2049 IC_kwDOBm6k_c5ZTd8l simonw 9599 2023-04-05T23:23:01Z 2023-04-05T23:23:01Z OWNER

The default representation here can be even smaller.

For rows it's this:

json { "ok": true, "next": "d,v", "rows": [...] } For SQL queries I'm considering this: json { "ok": true, "rows": [...] } I considered adding "sql" and "params" too, but on further thought those would be entirely a waste of bytes the majority of the time. If a user wants those they can request them with an ?_extra=query as seen here:

http://localhost:8001/content/releases.json?_size=0&_extra=query

json { "ok": true, "next": null, "query": { "sql": "select html_url, id, author, node_id, tag_name, target_commitish, name, draft, prerelease, created_at, published_at, body, repo, reactions, mentions_count from releases order by id limit 1", "params": {} }, "rows": [] }

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Custom SQL queries should use new JSON ?_extra= format 1646734246  
1489530555 https://github.com/simonw/datasette/issues/2049#issuecomment-1489530555 https://api.github.com/repos/simonw/datasette/issues/2049 IC_kwDOBm6k_c5YyG67 simonw 9599 2023-03-30T00:51:27Z 2023-03-30T00:51:27Z OWNER

I'd really like to refactor all of the extras functions into a datasette/extras.py module. The table ones currently rely a LOT on local variables in scope though, so I would need to rewrite those such that EVERY dependency they take is passed to asyncinject explicitly.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Custom SQL queries should use new JSON ?_extra= format 1646734246  
1489530037 https://github.com/simonw/datasette/issues/2049#issuecomment-1489530037 https://api.github.com/repos/simonw/datasette/issues/2049 IC_kwDOBm6k_c5YyGy1 simonw 9599 2023-03-30T00:50:30Z 2023-03-30T00:50:30Z OWNER

Two things to consider here: _shape= and _extra=.

Most of the shapes make sense, with the exception of ?_shape=object since we don't know which column we would use as a primary key.

Looking at the (undocumented) list of extras from the table view, here are the ones I think make sense:

  • count - YES
  • facet_results - no
  • facets_timed_out - no
  • suggested_facets - no
  • human_description_en - no
  • next_url - MAYBE
  • columns - YES
  • primary_keys - no
  • display_columns - YES
  • display_rows - YES
  • debug - YES?
  • request - YES
  • query - YES
  • metadata - YES
  • extras - YES
  • database - YES
  • table - no
  • database_color - no?
  • table_actions - no
  • filters - no
  • renderers - YES
  • custom_table_templates - no
  • sorted_facet_results - no
  • table_definition - no
  • view_definition - no
  • is_view - no
  • private - YES
  • expandable_columns - no
  • form_hidden_args - no

Just the YES ones:

  • count - this is new
  • columns
  • display_columns
  • display_rows
  • debug
  • request
  • query
  • metadata
  • extras
  • database
  • renderers
  • private

The count one is interesting - I think I can provide that by optionally running select count(*) from (inner query). It's a new feature though and not one I want to expose on the HTML view since it could result in poor performance - but having it as an extra that API users can opt into may make sense.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Custom SQL queries should use new JSON ?_extra= format 1646734246  
1489526501 https://github.com/simonw/datasette/issues/2049#issuecomment-1489526501 https://api.github.com/repos/simonw/datasette/issues/2049 IC_kwDOBm6k_c5YyF7l simonw 9599 2023-03-30T00:44:05Z 2023-03-30T00:44:05Z OWNER

As part of this I should be able to figure out which bits of the new code I wrote for the table view should actually be shared with the query view. That stuff is mostly going to be from this commit: https://github.com/simonw/datasette/commit/d97e82df3c8a3f2e97038d7080167be9bb74a68d

Here's the existing QueryView class I need to replace:

https://github.com/simonw/datasette/blob/4c1e277edbd783d06840d3f9b20bf00783478ce4/datasette/views/database.py#L215-L532

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Custom SQL queries should use new JSON ?_extra= format 1646734246  

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