Skip to content

Commit

Permalink
Fix misleading SQL Lab timeout error message (apache#3825)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored and Grace Guo committed Nov 10, 2017
1 parent 68f5f9f commit d377e86
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2138,14 +2138,12 @@ def sql_json(self):

# Sync request.
try:
SQLLAB_TIMEOUT = config.get("SQLLAB_TIMEOUT")
with utils.timeout(
seconds=SQLLAB_TIMEOUT,
error_message=(
"The query exceeded the {SQLLAB_TIMEOUT} seconds "
"timeout. You may want to run your query as a "
"`CREATE TABLE AS` to prevent timeouts."
).format(**locals())):
timeout = config.get("SQLLAB_TIMEOUT")
timeout_msg = (
"The query exceeded the {timeout} seconds "
"timeout.").format(**locals())
with utils.timeout(seconds=timeout,
error_message=timeout_msg):
# pylint: disable=no-value-for-parameter
data = sql_lab.get_sql_results(
query_id=query_id, return_results=True)
Expand Down

0 comments on commit d377e86

Please sign in to comment.