Fix: Query results in public dashboard not loading when query ends with semicolon (#6351)

* Fix: Query results in public dashboard not loading when query ends with semicolon

* fix flake8 error for commit 7a50b18d3

---------

Co-authored-by: Alexander Strickner <alexander.strickner@outlook.com>
This commit is contained in:
Manik Somayaji
2023-08-07 00:15:21 +05:30
committed by GitHub
parent 113146e4b8
commit f4a930ddeb

View File

@@ -308,15 +308,13 @@ class BaseSQLQueryRunner(BaseQueryRunner):
return str(parsed_query)
def apply_auto_limit(self, query_text, should_apply_auto_limit):
queries = split_sql_statements(query_text)
if should_apply_auto_limit:
queries = split_sql_statements(query_text)
# we only check for last one in the list because it is the one that we show result
last_query = queries[-1]
if self.query_is_select_no_limit(last_query):
queries[-1] = self.add_limit_to_query(last_query)
return combine_sql_statements(queries)
else:
return query_text
return combine_sql_statements(queries)
class BaseHTTPQueryRunner(BaseQueryRunner):