home / github

Menu
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

10 rows where issue = 472115381

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

id ▼ html_url issue_url node_id user created_at updated_at author_association body reactions issue performed_via_github_app
514509307 https://github.com/simonw/sqlite-utils/issues/49#issuecomment-514509307 https://api.github.com/repos/simonw/sqlite-utils/issues/49 MDEyOklzc3VlQ29tbWVudDUxNDUwOTMwNw== simonw 9599 2019-07-24T07:09:43Z 2019-07-24T07:10:21Z OWNER This syntax should be shared with #42 as much as possible. Maybe something based on a namedtuple would work, since those are already used in the library. ```python workouts = db.table("workouts", extracts=[Extract( columns=["source", "source_version"], table="Sources" )]) ``` Since namedtuples cannot have default values this should probably be a class instead. Actually it looks like there is a trick for defaults here: https://stackoverflow.com/a/18348004 {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} extracts= should support multiple-column extracts 472115381  
710346830 https://github.com/simonw/sqlite-utils/issues/49#issuecomment-710346830 https://api.github.com/repos/simonw/sqlite-utils/issues/49 MDEyOklzc3VlQ29tbWVudDcxMDM0NjgzMA== simonw 9599 2020-10-16T18:08:52Z 2020-10-16T18:09:21Z OWNER The new `.extract()` method can handle multiple columns: https://github.com/simonw/sqlite-utils/blob/2c541fac352632e23e40b0d21e3f233f7a744a57/tests/test_extract.py#L70-L87 {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} extracts= should support multiple-column extracts 472115381  
710359724 https://github.com/simonw/sqlite-utils/issues/49#issuecomment-710359724 https://api.github.com/repos/simonw/sqlite-utils/issues/49 MDEyOklzc3VlQ29tbWVudDcxMDM1OTcyNA== simonw 9599 2020-10-16T18:15:31Z 2020-10-16T18:15:31Z OWNER Using a tuple would work: ```python fresh_db.table("tree", extracts=[("common_name", "latin_name")]) ``` Or to define a custom name: ```python fresh_db.table("tree", extracts={("common_name", "latin_name"): "names"}) ``` {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} extracts= should support multiple-column extracts 472115381  
710363789 https://github.com/simonw/sqlite-utils/issues/49#issuecomment-710363789 https://api.github.com/repos/simonw/sqlite-utils/issues/49 MDEyOklzc3VlQ29tbWVudDcxMDM2Mzc4OQ== simonw 9599 2020-10-16T18:18:05Z 2020-10-16T18:18:05Z OWNER I wonder if there's value in extending the `extracts=` option at all given the existence of `table.extract()`. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} extracts= should support multiple-column extracts 472115381  
710364942 https://github.com/simonw/sqlite-utils/issues/49#issuecomment-710364942 https://api.github.com/repos/simonw/sqlite-utils/issues/49 MDEyOklzc3VlQ29tbWVudDcxMDM2NDk0Mg== simonw 9599 2020-10-16T18:18:48Z 2020-10-16T18:18:48Z OWNER I think there is. It's a nice existing feature, and I don't think adding tuple support to it would be a huge lift. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} extracts= should support multiple-column extracts 472115381  
710390915 https://github.com/simonw/sqlite-utils/issues/49#issuecomment-710390915 https://api.github.com/repos/simonw/sqlite-utils/issues/49 MDEyOklzc3VlQ29tbWVudDcxMDM5MDkxNQ== simonw 9599 2020-10-16T18:34:26Z 2020-10-16T18:34:50Z OWNER Here's the most complex example of `.extracts()`: ```python db["Trees"].extract( ["CommonName", "LatinName"], table="Species", fk_column="species_id", rename={"CommonName": "name", "LatinName": "latin"} ) ``` Resulting in: ```sql CREATE TABLE [Species] ( [id] INTEGER PRIMARY KEY, [name] TEXT, [latin] TEXT ) ``` From https://sqlite-utils.readthedocs.io/en/stable/python-api.html#extracting-columns-into-a-separate-table {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} extracts= should support multiple-column extracts 472115381  
710393550 https://github.com/simonw/sqlite-utils/issues/49#issuecomment-710393550 https://api.github.com/repos/simonw/sqlite-utils/issues/49 MDEyOklzc3VlQ29tbWVudDcxMDM5MzU1MA== simonw 9599 2020-10-16T18:35:57Z 2020-10-16T18:36:39Z OWNER If I want to support that most complicated example, I think the option to pass a `Extracts()` object to `extracts=` is the best way to do it: ```python fresh_db.table("tree", extracts=[Extract( columns=("CommonName", "LatinName"), table="Species", fk_column="species_id", rename={"CommonName": "name", "LatinName": "latin"} )]) ``` {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} extracts= should support multiple-column extracts 472115381  
710395444 https://github.com/simonw/sqlite-utils/issues/49#issuecomment-710395444 https://api.github.com/repos/simonw/sqlite-utils/issues/49 MDEyOklzc3VlQ29tbWVudDcxMDM5NTQ0NA== simonw 9599 2020-10-16T18:37:10Z 2020-10-16T18:37:10Z OWNER But this begins to feel too complicated, given that `table.extract()` can already be used to achieve the same thing. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} extracts= should support multiple-column extracts 472115381  
710397574 https://github.com/simonw/sqlite-utils/issues/49#issuecomment-710397574 https://api.github.com/repos/simonw/sqlite-utils/issues/49 MDEyOklzc3VlQ29tbWVudDcxMDM5NzU3NA== simonw 9599 2020-10-16T18:38:21Z 2020-10-16T18:38:21Z OWNER I'm not going to implement this. I'll leave `extract=...` as it is right now, suitable for quick simple single-column operations on input, but if users want to do something more complicated involving multiple columns they should use the `table.extract()` method after the initial insert instead. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} extracts= should support multiple-column extracts 472115381  
710461468 https://github.com/simonw/sqlite-utils/issues/49#issuecomment-710461468 https://api.github.com/repos/simonw/sqlite-utils/issues/49 MDEyOklzc3VlQ29tbWVudDcxMDQ2MTQ2OA== simonw 9599 2020-10-16T19:18:19Z 2020-10-16T19:18:19Z OWNER Reconsidering: #89 was a feature request that relates to this, so maybe this is worth implementing after all. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} extracts= should support multiple-column extracts 472115381  

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 15.531ms · About: simonw/datasette-graphql