{"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":4,"created_at":"2016-08-02T15:22:36Z","updated_at":"2016-08-02T19:51:06Z","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/237022636","html_url":"https://github.com/airbnb/caravel/issues/875#issuecomment-237022636","issue_url":"https://api.github.com/repos/airbnb/caravel/issues/875","id":237022636,"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:51:06Z","updated_at":"2016-08-02T19:51:06Z","body":"Hi Alexy,\n\nThis is actually possible at the moment although not how you might already\ndo the join. this method is way faster than using views (unless you're able\nto materialise).\n\nHead into your table setup and click the edit button:\n[image: pasted1]\nGo to the \"List Table Columns\" Tab and click add\n[image: pasted2]\ngive your column a name (in your case, \"language_code\" or something like\nthat), select group by and filter by and then in expression add something\nlike:\n\n```(select langauges.code from languages where language_id =\ndocuments.languages_id)```\n\nSave and then you should be able to group by this column.\n\nWhat you're effectively doing it added a composite column into the\nsqlalchemy model which is then injected directly into the query at runtime.\n\n\n\nOn Tue, 2 Aug 2016 at 20:07 Alexey Kondratov <notifications@github.com>\nwrote:\n\n> @mistercrunch <https://github.com/mistercrunch> I've seen this FAQ\n> answer, of course. But it looks more confusing than helpful for me, because\n> I understood it in a way, that I can create new views inside Caravel\n> somehow rather than directly inside DB. OK, thank you.\n>\n> —\n> You are receiving this because you are subscribed to this thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/airbnb/caravel/issues/875#issuecomment-237009890>, or mute\n> the thread\n> <https://github.com/notifications/unsubscribe-auth/AEdFuLIjq8oZLM5fEA2YZVSwLaascHuFks5qb5VNgaJpZM4Jaup3>\n> .\n>\n-- \n\n_______\nAlan Cruickshank\nE: alanmcruickshank@gmail.com\nT: +44 770 6851825\n"}}
{"actor":{"display_login":"alanmcruickshank"}}