{"action":"created","issue":{"url":"https://api.github.com/repos/airbnb/caravel/issues/875","repository_url":"https://api.github.com/repos/airbnb/caravel","labels_url":"https://api.github.com/repos/airbnb/caravel/issues/875/labels{/name}","comments_url":"https://api.github.com/repos/airbnb/caravel/issues/875/comments","events_url":"https://api.github.com/repos/airbnb/caravel/issues/875/events","html_url":"https://github.com/airbnb/caravel/issues/875","id":168913784,"number":875,"title":"Support of JOIN statement for queries","user":{"login":"ololobus","id":912790,"avatar_url":"https://avatars.githubusercontent.com/u/912790?v=3","gravatar_id":"","url":"https://api.github.com/users/ololobus","html_url":"https://github.com/ololobus","followers_url":"https://api.github.com/users/ololobus/followers","following_url":"https://api.github.com/users/ololobus/following{/other_user}","gists_url":"https://api.github.com/users/ololobus/gists{/gist_id}","starred_url":"https://api.github.com/users/ololobus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ololobus/subscriptions","organizations_url":"https://api.github.com/users/ololobus/orgs","repos_url":"https://api.github.com/users/ololobus/repos","events_url":"https://api.github.com/users/ololobus/events{/privacy}","received_events_url":"https://api.github.com/users/ololobus/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-08-02T15:22:36Z","updated_at":"2016-08-02T19:58:37Z","closed_at":"2016-08-02T17:58:19Z","body":"Are there any plans to add JOINs support?\r\n\r\nHere is a simple case: there are two tables `documents` and `languages`, every document has `language_id` column, every language has `name` and `code` columns. Thus, now I can only display distribution by `language_id` which is not too informative. \r\n![document_languages](https://cloud.githubusercontent.com/assets/912790/17333871/bf2054fe-58dc-11e6-92d3-279172218cb4.PNG)\r\n\r\nIt could be solved andding a simple join statement with select of e.g. `languages.code` instead of `documents.language_id`.\r\n\r\nI would be glad to help somehow and even started reading the project code, but it's hard enough to navigate through all this code. I found that main functions for queries performing are placed here https://github.com/airbnb/caravel/blob/master/caravel/models.py\r\n\r\nP.S. Sorry, if I missed something and there is already a possibility to do it somehow."},"comment":{"url":"https://api.github.com/repos/airbnb/caravel/issues/comments/237024747","html_url":"https://github.com/airbnb/caravel/issues/875#issuecomment-237024747","issue_url":"https://api.github.com/repos/airbnb/caravel/issues/875","id":237024747,"user":{"login":"alanmcruickshank","id":4670904,"avatar_url":"https://avatars.githubusercontent.com/u/4670904?v=3","gravatar_id":"","url":"https://api.github.com/users/alanmcruickshank","html_url":"https://github.com/alanmcruickshank","followers_url":"https://api.github.com/users/alanmcruickshank/followers","following_url":"https://api.github.com/users/alanmcruickshank/following{/other_user}","gists_url":"https://api.github.com/users/alanmcruickshank/gists{/gist_id}","starred_url":"https://api.github.com/users/alanmcruickshank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alanmcruickshank/subscriptions","organizations_url":"https://api.github.com/users/alanmcruickshank/orgs","repos_url":"https://api.github.com/users/alanmcruickshank/repos","events_url":"https://api.github.com/users/alanmcruickshank/events{/privacy}","received_events_url":"https://api.github.com/users/alanmcruickshank/received_events","type":"User","site_admin":false},"created_at":"2016-08-02T19:58:37Z","updated_at":"2016-08-02T19:58:37Z","body":"@ololobus @mistercrunch This is actually possible at the moment through some recently added functionality added for the work on additional datetimes. This method is way faster than using views (unless you're able to materialise), due to how sqlalchemy executes the query.\r\n\r\nHead into your table setup and click the edit button:\r\n![screenshot-a](https://cloud.githubusercontent.com/assets/4670904/17342961/627b51ba-58f3-11e6-87e2-dec7c26ead4e.png)\r\n\r\nGo to the \"List Table Columns\" Tab and click add\r\n![screenshot-b](https://cloud.githubusercontent.com/assets/4670904/17342962/6507221a-58f3-11e6-962b-0ae2f298bc6c.png)\r\n\r\ngive your column a name (in your case, `language_code` or something like that), select group by and filter by and then in expression add something like:\r\n\r\n`(select langauges.code from languages where language_id = documents.languages_id)`\r\n\r\nSave and then you should be able to group by this column.\r\n\r\nWhat you're effectively doing it added a composite column into the sqlalchemy model which is then injected directly into the query at runtime."}}
{"actor":{"display_login":"alanmcruickshank"}}