home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

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

  • row.update() or row.pk · 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
866184260 https://github.com/simonw/sqlite-utils/issues/267#issuecomment-866184260 https://api.github.com/repos/simonw/sqlite-utils/issues/267 MDEyOklzc3VlQ29tbWVudDg2NjE4NDI2MA== simonw 9599 2021-06-22T17:26:18Z 2021-06-22T17:27:27Z OWNER

If an.update() method doesn't work because it collides with an existing dictionary method a .pk property could still be nice: python for row in db["sometable"].rows: db["sometable"].update(row.pk, {"modified": 1})

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
row.update() or row.pk 915421499  
866182655 https://github.com/simonw/sqlite-utils/issues/267#issuecomment-866182655 https://api.github.com/repos/simonw/sqlite-utils/issues/267 MDEyOklzc3VlQ29tbWVudDg2NjE4MjY1NQ== simonw 9599 2021-06-22T17:24:03Z 2021-06-22T17:24:03Z OWNER

I'm re-opening this as a research task because it may be possible to cleanly implement this using a dict subclass - some notes on that here: https://treyhunner.com/2019/04/why-you-shouldnt-inherit-from-list-and-dict-in-python/

Since this would just be for adding methods (and maybe a property for returning the primary keys for a row) the usual disadvantages of subclassing dict described in that article shouldn't apply.

One catch: dictionaries already have a .update() method! So would have to pick another name.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
row.update() or row.pk 915421499  
862494864 https://github.com/simonw/sqlite-utils/issues/267#issuecomment-862494864 https://api.github.com/repos/simonw/sqlite-utils/issues/267 MDEyOklzc3VlQ29tbWVudDg2MjQ5NDg2NA== simonw 9599 2021-06-16T15:51:28Z 2021-06-16T16:26:15Z OWNER

I did add a slightly clumsy mechanism recently to help a bit here though: the pks_and_rows_where() method: https://sqlite-utils.datasette.io/en/stable/python-api.html#listing-rows-with-their-primary-keys

More details in the issue for that feature: #240

The idea here is that if you want to call update you need the primary key for the row - so you can do this:

python for pk, row in db["sometable"].pks_and_rows_where(): db["sometable"].update(pk, {"modified": 1}") The pk may end up as a single value or a tuple depending on if the table has a compound primary key - but you don't need to worry about that if you use this method as it will return the correct primary key value for you.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
row.update() or row.pk 915421499  
862493179 https://github.com/simonw/sqlite-utils/issues/267#issuecomment-862493179 https://api.github.com/repos/simonw/sqlite-utils/issues/267 MDEyOklzc3VlQ29tbWVudDg2MjQ5MzE3OQ== simonw 9599 2021-06-16T15:49:13Z 2021-06-16T15:49:13Z OWNER

The big challenge here is that the rows returned by this library aren't objects, they are Python dictionaries - so adding methods to them isn't possible without changing the type that is returned by these methods.

Part of the philosophy of the library is that it should make it as easy as possible to round-trip between Python dictionaries and SQLite table data, so I don't think adding methods like this is going to fit.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
row.update() or row.pk 915421499  

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