Skip to content

Commit

Permalink
[sql lab] handle query stop race condition (apache#4928)
Browse files Browse the repository at this point in the history
fixes apache#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.
  • Loading branch information
mistercrunch authored and michellethomas committed May 23, 2018
1 parent 55875d3 commit d1b44e4
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions superset/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit d1b44e4

Please sign in to comment.