{"html_url": "https://github.com/simonw/datasette/issues/1099#issuecomment-1402900354", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1099", "id": 1402900354, "node_id": "IC_kwDOBm6k_c5Tno-C", "user": {"value": 536941, "label": "fgregg"}, "created_at": "2023-01-25T00:58:26Z", "updated_at": "2023-01-25T00:58:26Z", "author_association": "CONTRIBUTOR", "body": "> My original idea for compound foreign keys was to turn both of those columns into links, but that doesn't fit here because `database_name` is already part of a different foreign key.\r\n\r\nit's pretty hard to know what the right thing to do is if a field is part of multiple foreign keys. \r\n\r\nbut, if that's not the case, what about making each of the columns a link. seems like an improvement over the status quo.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 743371103, "label": "Support linking to compound foreign keys"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1099#issuecomment-1402898291", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1099", "id": 1402898291, "node_id": "IC_kwDOBm6k_c5Tnodz", "user": {"value": 536941, "label": "fgregg"}, "created_at": "2023-01-25T00:55:06Z", "updated_at": "2023-01-25T00:55:06Z", "author_association": "CONTRIBUTOR", "body": "I went ahead and spiked something together, in #2003 ", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 743371103, "label": "Support linking to compound foreign keys"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1099#issuecomment-1402563930", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1099", "id": 1402563930, "node_id": "IC_kwDOBm6k_c5TmW1a", "user": {"value": 536941, "label": "fgregg"}, "created_at": "2023-01-24T20:11:11Z", "updated_at": "2023-01-24T20:11:11Z", "author_association": "CONTRIBUTOR", "body": "hi @simonw, this bug bit me today.\r\n\r\nthe UX for linking from a table to the foreign key seems tough! \r\n\r\nthe design in the other direction seems a lot easier, for a given primary key detail page, add links back to the tables that refer to the row.\r\n\r\nwould you be open to a PR that solved the second problem but not the first?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 743371103, "label": "Support linking to compound foreign keys"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1099#issuecomment-749845797", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1099", "id": 749845797, "node_id": "MDEyOklzc3VlQ29tbWVudDc0OTg0NTc5Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-12-23T00:13:29Z", "updated_at": "2020-12-23T00:14:25Z", "author_association": "OWNER", "body": "Also need to solve displaying these links in the opposite direction:\r\n\r\nhttps://latest.datasette.io/_internal/tables/fixtures,facet_cities\r\n\r\n\"_internal__tables\"\r\n\r\nThat page should link to lists of records in columns, foreign_keys and indexes - like this example: https://latest.datasette.io/fixtures/roadside_attractions/1\r\n\r\n\"fixtures__roadside_attractions\"\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 743371103, "label": "Support linking to compound foreign keys"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1099#issuecomment-749771231", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1099", "id": 749771231, "node_id": "MDEyOklzc3VlQ29tbWVudDc0OTc3MTIzMQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-12-22T20:54:25Z", "updated_at": "2020-12-22T20:54:25Z", "author_association": "OWNER", "body": "https://latest.datasette.io/_internal/foreign_keys (use https://latest.datasette.io/login-as-root first) is now a compound foreign key table:\r\n```sql\r\nCREATE TABLE foreign_keys (\r\n \"database_name\" TEXT,\r\n \"table_name\" TEXT,\r\n \"id\" INTEGER,\r\n \"seq\" INTEGER,\r\n \"table\" TEXT,\r\n \"from\" TEXT,\r\n \"to\" TEXT,\r\n \"on_update\" TEXT,\r\n \"on_delete\" TEXT,\r\n \"match\" TEXT,\r\n PRIMARY KEY (database_name, table_name, id, seq),\r\n FOREIGN KEY (database_name) REFERENCES databases(database_name),\r\n FOREIGN KEY (database_name, table_name) REFERENCES tables(database_name, table_name)\r\n );\r\n```\r\nCurrently the `database_name` column becomes a link (because it's a single foreign key) but the `table_name` one remains a non-link:\r\n\r\n\"_internal__foreign_keys__24_rows\"\r\n\r\nMy original idea for compound foreign keys was to turn both of those columns into links, but that doesn't fit here because `database_name` is already part of a different foreign key.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 743371103, "label": "Support linking to compound foreign keys"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1099#issuecomment-735444858", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1099", "id": 735444858, "node_id": "MDEyOklzc3VlQ29tbWVudDczNTQ0NDg1OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-11-29T19:51:58Z", "updated_at": "2020-11-29T19:51:58Z", "author_association": "OWNER", "body": "My fix in deb0be4ae56f191f121239b29e83dd53b62d6305 for #1098 was to have Datasette deliberately pretend that compound foreign keys don't exist: https://github.com/simonw/datasette/blob/deb0be4ae56f191f121239b29e83dd53b62d6305/datasette/utils/__init__.py#L470-L495\r\n\r\nThis workaround will need to be rethought to implement real support for them.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 743371103, "label": "Support linking to compound foreign keys"}, "performed_via_github_app": null}