Break line before LIMIT statement to prevent trailing comment issue (#7485)

* Break line before LIMIT statement to prevent trailing comment issue

This may not be a perfect solution but it addresses the issue in 7483

closes https://github.com/apache/incubator-superset/issues/7483

* fix tests
This commit is contained in:
Maxime Beauchemin
2019-05-13 00:34:34 -05:00
committed by GitHub
parent 4377328e39
commit d8be0a7dd5
4 changed files with 24 additions and 4 deletions

View File

@@ -168,7 +168,7 @@ class ParsedQuery(object):
"""returns the query with the specified limit"""
"""does not change the underlying query"""
if not self._limit:
return self.sql + ' LIMIT ' + str(new_limit)
return f'{self.sql}\nLIMIT {new_limit}'
limit_pos = None
tokens = self._parsed[0].tokens
# Add all items to before_str until there is a limit