home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

5 rows where issue = 1083657868 and "updated_at" is on date 2021-12-19 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 5

issue 1

  • Documented JavaScript variables on different templates made available for plugins · 5 ✖

author_association 1

  • OWNER 5
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
997474022 https://github.com/simonw/datasette/issues/1565#issuecomment-997474022 https://api.github.com/repos/simonw/datasette/issues/1565 IC_kwDOBm6k_c47dD7m simonw 9599 2021-12-19T22:36:49Z 2021-12-19T22:37:29Z OWNER

No way with a tagged template literal to pass an extra database name argument, so instead I need a method that returns a callable that can be used for the tagged template literal for a specific database - or the default database.

This could work (bit weird looking though): javascript var rows = await datasette.query("fixtures")`select * from foo`;

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documented JavaScript variables on different templates made available for plugins 1083657868  
997473856 https://github.com/simonw/datasette/issues/1565#issuecomment-997473856 https://api.github.com/repos/simonw/datasette/issues/1565 IC_kwDOBm6k_c47dD5A simonw 9599 2021-12-19T22:35:20Z 2021-12-19T22:35:20Z OWNER

Quick prototype of that tagged template query function:

``javascript function query(pieces, ...parameters) { var qs = new URLSearchParams(); var sql = pieces[0]; parameters.forEach((param, i) => { sql +=:p${i}${pieces[i + 1]}; qs.append(p${i}`, param); }); qs.append("sql", sql); return qs.toString(); }

var id = 4; console.log(queryselect * from ids where id > ${id}); Outputs: p0=4&sql=select+*+from+ids+where+id+%3E+%3Ap0 ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documented JavaScript variables on different templates made available for plugins 1083657868  
997472639 https://github.com/simonw/datasette/issues/1565#issuecomment-997472639 https://api.github.com/repos/simonw/datasette/issues/1565 IC_kwDOBm6k_c47dDl_ simonw 9599 2021-12-19T22:25:50Z 2021-12-19T22:25:50Z OWNER

Or... javascript rows = await datasette.query`select * from searchable where id > ${id}`; And it knows how to turn that into a parameterized call using tagged template literals.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documented JavaScript variables on different templates made available for plugins 1083657868  
997472509 https://github.com/simonw/datasette/issues/1565#issuecomment-997472509 https://api.github.com/repos/simonw/datasette/issues/1565 IC_kwDOBm6k_c47dDj9 simonw 9599 2021-12-19T22:24:50Z 2021-12-19T22:24:50Z OWNER

... huh, it could even expose a JavaScript function that can be called to execute a SQL query.

javascript datasette.query("select * from blah").then(...) Maybe it takes an optional second argument that specifies the database - defaulting to the one for the current page.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documented JavaScript variables on different templates made available for plugins 1083657868  
997472370 https://github.com/simonw/datasette/issues/1565#issuecomment-997472370 https://api.github.com/repos/simonw/datasette/issues/1565 IC_kwDOBm6k_c47dDhy simonw 9599 2021-12-19T22:23:36Z 2021-12-19T22:23:36Z OWNER

This should also expose the JSON API endpoints used to execute SQL against this database.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documented JavaScript variables on different templates made available for plugins 1083657868  

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