{"action":"created","issue":{"url":"https://api.github.com/repos/dbcli/pgcli/issues/496","repository_url":"https://api.github.com/repos/dbcli/pgcli","labels_url":"https://api.github.com/repos/dbcli/pgcli/issues/496/labels{/name}","comments_url":"https://api.github.com/repos/dbcli/pgcli/issues/496/comments","events_url":"https://api.github.com/repos/dbcli/pgcli/issues/496/events","html_url":"https://github.com/dbcli/pgcli/pull/496","id":154737041,"number":496,"title":"Support for join-condition suggestions after ON","user":{"login":"koljonen","id":18589234,"avatar_url":"https://avatars.githubusercontent.com/u/18589234?v=3","gravatar_id":"","url":"https://api.github.com/users/koljonen","html_url":"https://github.com/koljonen","followers_url":"https://api.github.com/users/koljonen/followers","following_url":"https://api.github.com/users/koljonen/following{/other_user}","gists_url":"https://api.github.com/users/koljonen/gists{/gist_id}","starred_url":"https://api.github.com/users/koljonen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koljonen/subscriptions","organizations_url":"https://api.github.com/users/koljonen/orgs","repos_url":"https://api.github.com/users/koljonen/repos","events_url":"https://api.github.com/users/koljonen/events{/privacy}","received_events_url":"https://api.github.com/users/koljonen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-13T15:20:46Z","updated_at":"2016-05-15T18:43:36Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/dbcli/pgcli/pulls/496","html_url":"https://github.com/dbcli/pgcli/pull/496","diff_url":"https://github.com/dbcli/pgcli/pull/496.diff","patch_url":"https://github.com/dbcli/pgcli/pull/496.patch"},"body":"The user types 'SELECT * FROM parenttable p JOIN childtable c on '. We then suggest ['c.parenttableid = p.parenttableid', 'c.createdby = p.createdby', ...] as completions.\r\nThe suggestions are FK matches first, then name matches for int columns, then name matches for other columns.\r\n\r\nSome things that have been changed in order to make this work:\r\n    meta[reltype]][relname] goes from being a list of columns to being a list of ColumnMetadata namedtuples, which, apart from the column name, also contains its data type and a list of FKs from the column (i.e. where the column is a child). This entails modification of a number of functions dealing with columns.\r\n    get_matches can now be fed with priorities from outside, enabling more intelligent sorting.\r\n    TableReference gets a property, ref, that returns COALESCE(Alias, TableName).\r\n    populate_scoped_cols now returns a dict {TableReference:{colname:ColumnMetadata}} instead of just a list [colname]."},"comment":{"url":"https://api.github.com/repos/dbcli/pgcli/issues/comments/219303033","html_url":"https://github.com/dbcli/pgcli/pull/496#issuecomment-219303033","issue_url":"https://api.github.com/repos/dbcli/pgcli/issues/496","id":219303033,"user":{"login":"darikg","id":6875882,"avatar_url":"https://avatars.githubusercontent.com/u/6875882?v=3","gravatar_id":"","url":"https://api.github.com/users/darikg","html_url":"https://github.com/darikg","followers_url":"https://api.github.com/users/darikg/followers","following_url":"https://api.github.com/users/darikg/following{/other_user}","gists_url":"https://api.github.com/users/darikg/gists{/gist_id}","starred_url":"https://api.github.com/users/darikg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darikg/subscriptions","organizations_url":"https://api.github.com/users/darikg/orgs","repos_url":"https://api.github.com/users/darikg/repos","events_url":"https://api.github.com/users/darikg/events{/privacy}","received_events_url":"https://api.github.com/users/darikg/received_events","type":"User","site_admin":false},"created_at":"2016-05-15T18:43:36Z","updated_at":"2016-05-15T18:43:36Z","body":"This is a pretty big change, so it will take me some time to get through. I like the direction it's going in."}}