{"html_url": "https://github.com/simonw/sqlite-utils/pull/203#issuecomment-1033641009", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/203", "id": 1033641009, "node_id": "IC_kwDOCGYnMM49nBwx", "user": {"value": 82988, "label": "psychemedia"}, "created_at": "2022-02-09T11:06:18Z", "updated_at": "2022-02-09T11:06:18Z", "author_association": "NONE", "body": "Is there any progress elsewhere on the handling of compound / composite foreign keys, or is this PR still effectively open?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 743384829, "label": "changes to allow for compound foreign keys"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/pull/203#issuecomment-1404070841", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/203", "id": 1404070841, "node_id": "IC_kwDOCGYnMM5TsGu5", "user": {"value": 536941, "label": "fgregg"}, "created_at": "2023-01-25T18:47:18Z", "updated_at": "2023-01-25T18:47:18Z", "author_association": "CONTRIBUTOR", "body": "i'll adopt this PR to make the changes @simonw suggested https://github.com/simonw/sqlite-utils/pull/203#issuecomment-753567932", "reactions": "{\"total_count\": 1, \"+1\": 1, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 743384829, "label": "changes to allow for compound foreign keys"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/pull/203#issuecomment-743966289", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/203", "id": 743966289, "node_id": "MDEyOklzc3VlQ29tbWVudDc0Mzk2NjI4OQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-12-13T07:20:51Z", "updated_at": "2020-12-13T07:20:51Z", "author_association": "OWNER", "body": "Sorry for not reviewing this yet! I'll try to carve out time to look at it in the next few days.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 743384829, "label": "changes to allow for compound foreign keys"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/pull/203#issuecomment-753567508", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/203", "id": 753567508, "node_id": "MDEyOklzc3VlQ29tbWVudDc1MzU2NzUwOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-01-03T04:48:17Z", "updated_at": "2021-01-03T04:48:17Z", "author_association": "OWNER", "body": "Sorry for taking so long to review this!\r\n\r\nThis 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.\r\n\r\nThere'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.\r\n\r\nThis 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.\r\n\r\nAs such, I'd have to bump the major version of `sqlite-utils` to `4.0` in order to ship this.\r\n\r\nIdeally 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.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 743384829, "label": "changes to allow for compound foreign keys"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/pull/203#issuecomment-753567744", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/203", "id": 753567744, "node_id": "MDEyOklzc3VlQ29tbWVudDc1MzU2Nzc0NA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-01-03T04:51:44Z", "updated_at": "2021-01-03T04:51:44Z", "author_association": "OWNER", "body": "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.\r\n\r\nThis 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.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 743384829, "label": "changes to allow for compound foreign keys"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/pull/203#issuecomment-753567932", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/203", "id": 753567932, "node_id": "MDEyOklzc3VlQ29tbWVudDc1MzU2NzkzMg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-01-03T04:54:43Z", "updated_at": "2021-01-03T04:54:43Z", "author_association": "OWNER", "body": "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.\r\n\r\nThe question then is what should `.column` and `.other_column` return for compound foreign keys?\r\n\r\nI'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.\r\n\r\nWe can label `.column` and `.other_column` as deprecated and then remove them in `sqlite-utils 4.0`.\r\n\r\nSince 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.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 743384829, "label": "changes to allow for compound foreign keys"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/pull/203#issuecomment-774217792", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/203", "id": 774217792, "node_id": "MDEyOklzc3VlQ29tbWVudDc3NDIxNzc5Mg==", "user": {"value": 1049910, "label": "drkane"}, "created_at": "2021-02-05T18:44:13Z", "updated_at": "2021-02-05T18:44:13Z", "author_association": "NONE", "body": "Thanks for looking at this - home schooling kids has prevented me from replying. \r\n\r\nI'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.\r\n\r\nI'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.\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 743384829, "label": "changes to allow for compound foreign keys"}, "performed_via_github_app": null}