From f4a930ddeba756fc67dc237fb7523e4d8889b9b5 Mon Sep 17 00:00:00 2001 From: Manik Somayaji <32429285+manikBS@users.noreply.github.com> Date: Mon, 7 Aug 2023 00:15:21 +0530 Subject: [PATCH] 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 --- redash/query_runner/__init__.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/redash/query_runner/__init__.py b/redash/query_runner/__init__.py index 3f7199a93..361b7863d 100644 --- a/redash/query_runner/__init__.py +++ b/redash/query_runner/__init__.py @@ -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):