lebinh / aq

Query AWS resources with SQL
MIT License
201 stars 17 forks source link

Unable to query with multiple WHERE clauses #1

Closed lukeasrodgers closed 8 years ago

lukeasrodgers commented 8 years ago

Perhaps I'm doing something wrong, but I can't get multiple WHERE clauses to work with aq.

e.g. (inline table just for demo, same problem occurs with "real" queries)

> select * from (select 10 as id UNION select 11 as id UNION select 12 as id UNION select 13 as id)
+------+
|   id |
|------|
|   10 |
|   11 |
|   12 |
|   13 |
+------+
> select * from (select 10 as id UNION select 11 as id UNION select 12 as id UNION select 13 as id) WHERE id > 10
+------+
|   id |
|------|
|   11 |
|   12 |
|   13 |
+------+

However, all of the following result in an "Invalid SQL query" error:

select * from (select 10 as id UNION select 11 as id UNION select 12 as id UNION select 13 as id) WHERE id > 10 AND id < 15
select * from (select 10 as id UNION select 11 as id UNION select 12 as id UNION select 13 as id) WHERE (id > 10 AND id < 15)

python Version 2.7.10 aq Version: 0.1.1

thanks

lebinh commented 8 years ago

hi @lukeasrodgers, this looks like a bug with the SQL parser, I will try to push a fix soon

lebinh commented 8 years ago

@lukeasrodgers fixed in https://github.com/lebinh/aq/commit/0ab172ffb17997fad61d22f2f37ab1cb97159649