home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

7 rows where issue = 743384829 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 4

  • simonw 4
  • psychemedia 1
  • fgregg 1
  • drkane 1

author_association 3

  • OWNER 4
  • NONE 2
  • CONTRIBUTOR 1

issue 1

  • changes to allow for compound foreign keys · 7 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
1404070841 https://github.com/simonw/sqlite-utils/pull/203#issuecomment-1404070841 https://api.github.com/repos/simonw/sqlite-utils/issues/203 IC_kwDOCGYnMM5TsGu5 fgregg 536941 2023-01-25T18:47:18Z 2023-01-25T18:47:18Z CONTRIBUTOR

i'll adopt this PR to make the changes @simonw suggested https://github.com/simonw/sqlite-utils/pull/203#issuecomment-753567932

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
changes to allow for compound foreign keys 743384829  
1033641009 https://github.com/simonw/sqlite-utils/pull/203#issuecomment-1033641009 https://api.github.com/repos/simonw/sqlite-utils/issues/203 IC_kwDOCGYnMM49nBwx psychemedia 82988 2022-02-09T11:06:18Z 2022-02-09T11:06:18Z NONE

Is there any progress elsewhere on the handling of compound / composite foreign keys, or is this PR still effectively open?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
changes to allow for compound foreign keys 743384829  
774217792 https://github.com/simonw/sqlite-utils/pull/203#issuecomment-774217792 https://api.github.com/repos/simonw/sqlite-utils/issues/203 MDEyOklzc3VlQ29tbWVudDc3NDIxNzc5Mg== drkane 1049910 2021-02-05T18:44:13Z 2021-02-05T18:44:13Z NONE

Thanks for looking at this - home schooling kids has prevented me from replying.

I'd struggled with how to adapt the API for the foreign keys too - I definitely tried the String/Tuple approach. I hadn't considered the breaking changes that would introduce though. I can take a look at this and try and make the change - see which of your options works best.

I've got a workaround for the use-case I was looking at this for, so it wouldn't be a problem for me if it was put on the back burner until a hypothetical v4.0 anyway.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
changes to allow for compound foreign keys 743384829  
753567932 https://github.com/simonw/sqlite-utils/pull/203#issuecomment-753567932 https://api.github.com/repos/simonw/sqlite-utils/issues/203 MDEyOklzc3VlQ29tbWVudDc1MzU2NzkzMg== simonw 9599 2021-01-03T04:54:43Z 2021-01-03T04:54:43Z OWNER

Another option: expand the ForeignKey object to have .columns and .other_columns properties in addition to the existing .column and .other_column properties. These new plural properties would always return a tuple, which would be a one-item tuple for a non-compound-foreign-key.

The question then is what should .column and .other_column return for compound foreign keys?

I'd be inclined to say they should return None - which would trigger errors in code that encounters a compound foreign key for the first time, but those errors would at least be a strong indicator as to what had gone wrong.

We can label .column and .other_column as deprecated and then remove them in sqlite-utils 4.0.

Since this would still be a breaking change in some minor edge-cases I'm thinking maybe 4.0 needs to happen in order to land this feature. I'm not opposed to doing that, I was just hoping it might be avoidable.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
changes to allow for compound foreign keys 743384829  
753567744 https://github.com/simonw/sqlite-utils/pull/203#issuecomment-753567744 https://api.github.com/repos/simonw/sqlite-utils/issues/203 MDEyOklzc3VlQ29tbWVudDc1MzU2Nzc0NA== simonw 9599 2021-01-03T04:51:44Z 2021-01-03T04:51:44Z OWNER

One way that this could avoid a breaking change would be to have fk.column and fk.other_column remain as strings for non-compound-foreign-keys, but turn into tuples for a compound foreign key.

This is a bit of an ugly API design, and it could still break existing code that encounters a compound foreign key for the first time - but it would leave code working for the more common case of a non-compound-foreign-key.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
changes to allow for compound foreign keys 743384829  
753567508 https://github.com/simonw/sqlite-utils/pull/203#issuecomment-753567508 https://api.github.com/repos/simonw/sqlite-utils/issues/203 MDEyOklzc3VlQ29tbWVudDc1MzU2NzUwOA== simonw 9599 2021-01-03T04:48:17Z 2021-01-03T04:48:17Z OWNER

Sorry for taking so long to review this!

This approach looks great to me - being able to optionally pass a tuple anywhere the API currently expects a column is smart, and it's consistent with how the pk= parameter works elsewhere.

There's just one problem I can see with this: the way it changes the ForeignKey(...) interface to always return a tuple for .column and .other_column, even if that tuple only contains a single item.

This represents a breaking change to the existing API - any code that expects ForeignKey.column to be a single string (which is any code that has been written against that) will break.

As such, I'd have to bump the major version of sqlite-utils to 4.0 in order to ship this.

Ideally I'd like to make this change in a way that doesn't represent an API compatibility break. I need to think a bit harder about how that might be achieved.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
changes to allow for compound foreign keys 743384829  
743966289 https://github.com/simonw/sqlite-utils/pull/203#issuecomment-743966289 https://api.github.com/repos/simonw/sqlite-utils/issues/203 MDEyOklzc3VlQ29tbWVudDc0Mzk2NjI4OQ== simonw 9599 2020-12-13T07:20:51Z 2020-12-13T07:20:51Z OWNER

Sorry for not reviewing this yet! I'll try to carve out time to look at it in the next few days.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
changes to allow for compound foreign keys 743384829  

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