mirror of
https://github.com/apache/superset.git
synced 2026-04-12 04:37:49 +00:00
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:
committed by
GitHub
parent
4377328e39
commit
d8be0a7dd5
@@ -431,6 +431,25 @@ class SupersetTestCase(unittest.TestCase):
|
||||
"""
|
||||
self.assertEquals({'SalesOrderHeader'}, self.extract_tables(query))
|
||||
|
||||
def test_get_query_with_new_limit_comment(self):
|
||||
sql = 'SELECT * FROM ab_user --SOME COMMENT'
|
||||
parsed = sql_parse.ParsedQuery(sql)
|
||||
newsql = parsed.get_query_with_new_limit(1000)
|
||||
self.assertEquals(newsql, sql + '\nLIMIT 1000')
|
||||
|
||||
def test_get_query_with_new_limit_comment_with_limit(self):
|
||||
sql = 'SELECT * FROM ab_user --SOME COMMENT WITH LIMIT 555'
|
||||
parsed = sql_parse.ParsedQuery(sql)
|
||||
newsql = parsed.get_query_with_new_limit(1000)
|
||||
self.assertEquals(newsql, sql + '\nLIMIT 1000')
|
||||
|
||||
def test_get_query_with_new_limit(self):
|
||||
sql = 'SELECT * FROM ab_user LIMIT 555'
|
||||
parsed = sql_parse.ParsedQuery(sql)
|
||||
newsql = parsed.get_query_with_new_limit(1000)
|
||||
expected = 'SELECT * FROM ab_user LIMIT 1000'
|
||||
self.assertEquals(newsql, expected)
|
||||
|
||||
def test_basic_breakdown_statements(self):
|
||||
multi_sql = """
|
||||
SELECT * FROM ab_user;
|
||||
|
||||
Reference in New Issue
Block a user