You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/01/16 00:55:56 UTC
[GitHub] betodealmeida opened a new pull request #6703: Trim query before
parsing
betodealmeida opened a new pull request #6703: Trim query before parsing
URL: https://github.com/apache/incubator-superset/pull/6703
The `ParsedQuery` init does not ignore empty lines. If we have a query with a trailing line, eg:
```sql
SELECT a FROM b LIMIT 1;
```
The parser will set `self._limit` to `None`:
```python
self._parsed = sqlparse.parse(self.sql)
for statement in self._parsed:
self.__extract_from_token(statement)
self._limit = self._extract_limit_from_query(statement)
```
Since the loop will run twice, first for `'SELECT a FROM b LIMIT 1;'` and again for `''`.
This PR fixes this by trimming the SQL before parsing it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org