{"action":"created","issue":{"url":"https://api.github.com/repos/metabase/metabase/issues/5861","repository_url":"https://api.github.com/repos/metabase/metabase","labels_url":"https://api.github.com/repos/metabase/metabase/issues/5861/labels{/name}","comments_url":"https://api.github.com/repos/metabase/metabase/issues/5861/comments","events_url":"https://api.github.com/repos/metabase/metabase/issues/5861/events","html_url":"https://github.com/metabase/metabase/pull/5861","id":254414773,"node_id":"MDExOlB1bGxSZXF1ZXN0MTM4NzI2NDY0","number":5861,"title":"Fix for upstream issue 5648","user":{"login":"joshuashort","id":1498607,"node_id":"MDQ6VXNlcjE0OTg2MDc=","avatar_url":"https://avatars1.githubusercontent.com/u/1498607?v=4","gravatar_id":"","url":"https://api.github.com/users/joshuashort","html_url":"https://github.com/joshuashort","followers_url":"https://api.github.com/users/joshuashort/followers","following_url":"https://api.github.com/users/joshuashort/following{/other_user}","gists_url":"https://api.github.com/users/joshuashort/gists{/gist_id}","starred_url":"https://api.github.com/users/joshuashort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshuashort/subscriptions","organizations_url":"https://api.github.com/users/joshuashort/orgs","repos_url":"https://api.github.com/users/joshuashort/repos","events_url":"https://api.github.com/users/joshuashort/events{/privacy}","received_events_url":"https://api.github.com/users/joshuashort/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2017-08-31T17:43:36Z","updated_at":"2019-01-04T23:55:48Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/metabase/metabase/pulls/5861","html_url":"https://github.com/metabase/metabase/pull/5861","diff_url":"https://github.com/metabase/metabase/pull/5861.diff","patch_url":"https://github.com/metabase/metabase/pull/5861.patch"},"body":"Simple fix for [issue #5648](https://github.com/metabase/metabase/issues/5648).\r\n\r\nInstead of looking for the first primary key in the destination table, this looks for the column which matches the relationship specified by the foreign key; as far as I can tell, this is more robust and allows for a situation which wasn't explicitly disallowed, but wasn't actually supported completely before -- accurate relationship counting and drill-through on tables with more than one entity key.\r\n\r\nSince the target column id is known, it makes sense to use that to match a column instead of grabbing the first thing that is a primary key.\r\n\r\n###### TODO \r\n-  [x] Sign the [Contributor License Agreement](https://docs.google.com/a/metabase.com/forms/d/1oV38o7b9ONFSwuzwmERRMi9SYrhYeOrkbmNaq9pOJ_E/viewform)\r\n(unless it's a tiny documentation change).\r\n"},"comment":{"url":"https://api.github.com/repos/metabase/metabase/issues/comments/451604044","html_url":"https://github.com/metabase/metabase/pull/5861#issuecomment-451604044","issue_url":"https://api.github.com/repos/metabase/metabase/issues/5861","id":451604044,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MTYwNDA0NA==","user":{"login":"joshuashort","id":1498607,"node_id":"MDQ6VXNlcjE0OTg2MDc=","avatar_url":"https://avatars1.githubusercontent.com/u/1498607?v=4","gravatar_id":"","url":"https://api.github.com/users/joshuashort","html_url":"https://github.com/joshuashort","followers_url":"https://api.github.com/users/joshuashort/followers","following_url":"https://api.github.com/users/joshuashort/following{/other_user}","gists_url":"https://api.github.com/users/joshuashort/gists{/gist_id}","starred_url":"https://api.github.com/users/joshuashort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshuashort/subscriptions","organizations_url":"https://api.github.com/users/joshuashort/orgs","repos_url":"https://api.github.com/users/joshuashort/repos","events_url":"https://api.github.com/users/joshuashort/events{/privacy}","received_events_url":"https://api.github.com/users/joshuashort/received_events","type":"User","site_admin":false},"created_at":"2019-01-04T23:55:48Z","updated_at":"2019-01-04T23:55:48Z","author_association":"CONTRIBUTOR","body":"Admittedly, this might not be seen as a major issue, but it seems like something that is unnecessarily broken (with a clear resolution). The old/current way of doing things is unbelievably naive and breaks (unnecessarily).\r\n\r\nI came across this issue (probably like @ryan-tangocard) when using a table that is used as a 'hub' to link two (previously-implicitly-related) databases while consolidating into a single warehouse. There are legitimately 2 columns which can be marked as `Entity Key`, as each are Unique on the table, and each serve as the destination of a foreign key in different domains.\r\n\r\nThis PR breaks nothing (given the current paradigm of a single key), and it further enables 'unofficial' structures. I'll post some screenshots of what's broken to further drive the point..\r\n\r\n"}}
{"actor":{"display_login":"joshuashort"}}