From dad5c9272e3032106ef513cdad18bfed20bcea43 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 7 May 2018 13:49:42 -0700 Subject: [PATCH] [sql lab] handle query stop race condition (#4928) fixes https://github.com/apache/incubator-superset/issues/4926 In rare cases where the query is stopped before it is started, SQL Lab returns an unexpected string payload instead of a normal dictionary. This aligns the process to handle the error in a homogeneous fashion. --- superset/sql_lab.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/superset/sql_lab.py b/superset/sql_lab.py index b52e9a95f6b38..750da1f37615d 100644 --- a/superset/sql_lab.py +++ b/superset/sql_lab.py @@ -232,13 +232,7 @@ def handle_error(msg): conn.close() if query.status == utils.QueryStatus.STOPPED: - return json.dumps( - { - 'query_id': query.id, - 'status': query.status, - 'query': query.to_dict(), - }, - default=utils.json_iso_dttm_ser) + return handle_error('The query has been stopped') cdf = convert_results_to_df(cursor_description, data)