{"action":"created","issue":{"url":"https://api.github.com/repos/pudo/dataset/issues/116","labels_url":"https://api.github.com/repos/pudo/dataset/issues/116/labels{/name}","comments_url":"https://api.github.com/repos/pudo/dataset/issues/116/comments","events_url":"https://api.github.com/repos/pudo/dataset/issues/116/events","html_url":"https://github.com/pudo/dataset/issues/116","id":55056242,"number":116,"title":"Support for IN clauses in raw SQL queries","user":{"login":"ghostwords","id":794578,"avatar_url":"https://avatars.githubusercontent.com/u/794578?v=3","gravatar_id":"","url":"https://api.github.com/users/ghostwords","html_url":"https://github.com/ghostwords","followers_url":"https://api.github.com/users/ghostwords/followers","following_url":"https://api.github.com/users/ghostwords/following{/other_user}","gists_url":"https://api.github.com/users/ghostwords/gists{/gist_id}","starred_url":"https://api.github.com/users/ghostwords/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghostwords/subscriptions","organizations_url":"https://api.github.com/users/ghostwords/orgs","repos_url":"https://api.github.com/users/ghostwords/repos","events_url":"https://api.github.com/users/ghostwords/events{/privacy}","received_events_url":"https://api.github.com/users/ghostwords/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-21T18:17:29Z","updated_at":"2015-05-22T17:51:46Z","closed_at":"2015-05-21T20:43:53Z","body":"Trying to do an IN clause in a raw SQL query; this is what I got so far:\r\n```python\r\nif ids:\r\n    in_clause = \"AND id IN (%s)\" % ','.join(\r\n        [str(int(id)) for id in ids])\r\n\r\nsql = \"\"\"SELECT url, error, COUNT(*) count\r\n    FROM result\r\n    WHERE error IS NOT NULL %s\r\n    GROUP BY url, error\r\n    ORDER BY count DESC\"\"\" % (in_clause if ids else \"\")\r\n\r\nwith dataset.connect(app.config['DATABASE_URL']) as db:\r\n    result = db.query(sql)\r\n```\r\nDo you see any issues with this workaround?\r\n\r\nThis is related to #115. Dataset wraps around SQLAlchemy, which has no real support for IN clauses in raw text queries, from what I understand. While it looks like IN clauses are supported via SQLAlchemy's expression language, having to deal with it seems far away from \"[making] using SQL databases in Python a breeze\"."},"comment":{"url":"https://api.github.com/repos/pudo/dataset/issues/comments/104728039","html_url":"https://github.com/pudo/dataset/issues/116#issuecomment-104728039","issue_url":"https://api.github.com/repos/pudo/dataset/issues/116","id":104728039,"user":{"login":"ghostwords","id":794578,"avatar_url":"https://avatars.githubusercontent.com/u/794578?v=3","gravatar_id":"","url":"https://api.github.com/users/ghostwords","html_url":"https://github.com/ghostwords","followers_url":"https://api.github.com/users/ghostwords/followers","following_url":"https://api.github.com/users/ghostwords/following{/other_user}","gists_url":"https://api.github.com/users/ghostwords/gists{/gist_id}","starred_url":"https://api.github.com/users/ghostwords/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghostwords/subscriptions","organizations_url":"https://api.github.com/users/ghostwords/orgs","repos_url":"https://api.github.com/users/ghostwords/repos","events_url":"https://api.github.com/users/ghostwords/events{/privacy}","received_events_url":"https://api.github.com/users/ghostwords/received_events","type":"User","site_admin":false},"created_at":"2015-05-22T17:51:45Z","updated_at":"2015-05-22T17:51:45Z","body":"Cool, thanks for the code translation! Building SQL by string manipulation is pretty gross.\r\n\r\nThe gaps in raw SQL parameter substitution support are still a problem. I think they should at least get called out along with suggested workarounds in the docs somewhere."}}