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

This commit is contained in:
Alexander Strickner
2022-08-02 21:22:42 +02:00
committed by Manik Somayaji
parent 113146e4b8
commit 7a50b18d31

View File

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