home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

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

  • Allow .insert(..., foreign_keys=()) to auto-detect table and primary key · 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
501548676 https://github.com/simonw/sqlite-utils/issues/25#issuecomment-501548676 https://api.github.com/repos/simonw/sqlite-utils/issues/25 MDEyOklzc3VlQ29tbWVudDUwMTU0ODY3Ng== simonw 9599 2019-06-13T04:58:12Z 2019-06-13T04:58:12Z OWNER

I'm going to reuse the ForeignKey named tuple here:

https://github.com/simonw/sqlite-utils/blob/d645032cfa4edbccd0542eecdddca29edf9f7b07/sqlite_utils/db.py#L17-L19

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow .insert(..., foreign_keys=()) to auto-detect table and primary key 449848803  
501548097 https://github.com/simonw/sqlite-utils/issues/25#issuecomment-501548097 https://api.github.com/repos/simonw/sqlite-utils/issues/25 MDEyOklzc3VlQ29tbWVudDUwMTU0ODA5Nw== simonw 9599 2019-06-13T04:54:33Z 2019-06-13T04:54:33Z OWNER

Still need to add this mechanism to .create_table() - this code here is all that needs to be modified - it needs to learn to deal with the alternative syntax for foreign keys and guess the missing data if necessary:

https://github.com/simonw/sqlite-utils/blob/d645032cfa4edbccd0542eecdddca29edf9f7b07/sqlite_utils/db.py#L115-L119

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow .insert(..., foreign_keys=()) to auto-detect table and primary key 449848803  
501517535 https://github.com/simonw/sqlite-utils/issues/25#issuecomment-501517535 https://api.github.com/repos/simonw/sqlite-utils/issues/25 MDEyOklzc3VlQ29tbWVudDUwMTUxNzUzNQ== simonw 9599 2019-06-13T01:50:34Z 2019-06-13T01:50:34Z OWNER

If I'm going to do this then I should make the other_table and other_column arguments optional here too:

https://github.com/simonw/sqlite-utils/blob/2fed87da6ea990d295672e4db2c8ae97b787913e/sqlite_utils/cli.py#L201-L215

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow .insert(..., foreign_keys=()) to auto-detect table and primary key 449848803  
501516797 https://github.com/simonw/sqlite-utils/issues/25#issuecomment-501516797 https://api.github.com/repos/simonw/sqlite-utils/issues/25 MDEyOklzc3VlQ29tbWVudDUwMTUxNjc5Nw== simonw 9599 2019-06-13T01:46:36Z 2019-06-13T01:47:35Z OWNER

Maybe foreign_keys could even optionally just be a list of columns - it could then attempt to detect the related tables based on some rules-of-thumb and raise an error if there's no obvious candidate.

Rules: * If the column name ends in _id, remove that suffix and look for a matching table. * Try for a table which is the column name without the _id suffix with an s appended to it * Try for a table that's the exact match for the column name

If none of these rules match, raise an error.

So the above example could be further simplified to: python db["usages"].insert_all( usages_to_insert, foreign_keys=["line_id", "definition_id"] )

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow .insert(..., foreign_keys=()) to auto-detect table and primary key 449848803  

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