From dfde3df5f7c85fedacc81e5b690ef0444c5c53d9 Mon Sep 17 00:00:00 2001 From: Diego Medina Date: Mon, 23 May 2022 18:50:09 -0300 Subject: [PATCH] fix(sql lab): View result button is not showing consistently --- superset-frontend/src/SqlLab/reducers/sqlLab.js | 6 ++++++ superset/sql_lab.py | 1 + 2 files changed, 7 insertions(+) diff --git a/superset-frontend/src/SqlLab/reducers/sqlLab.js b/superset-frontend/src/SqlLab/reducers/sqlLab.js index 923caaf96152d..f9153e84a1172 100644 --- a/superset-frontend/src/SqlLab/reducers/sqlLab.js +++ b/superset-frontend/src/SqlLab/reducers/sqlLab.js @@ -340,6 +340,12 @@ export default function sqlLabReducer(state = {}, action) { errorMessage: null, cached: false, }; + + const resultsKey = action?.results?.query?.resultsKey; + if (resultsKey) { + alts.resultsKey = resultsKey; + } + return alterInObject(state, 'queries', action.query, alts); }, [actions.QUERY_FAILED]() { diff --git a/superset/sql_lab.py b/superset/sql_lab.py index 2eeb2976b4126..785d16327f7f2 100644 --- a/superset/sql_lab.py +++ b/superset/sql_lab.py @@ -548,6 +548,7 @@ def execute_sql_statements( # pylint: disable=too-many-arguments, too-many-loca if store_results and results_backend: key = str(uuid.uuid4()) + payload["query"]["resultsKey"] = key logger.info( "Query %s: Storing results in results backend, key: %s", str(query_id), key )