serenajiang commented on a change in pull request #8037: fix: handle case where 
result exists but corresponding query cannot be found
URL: 
https://github.com/apache/incubator-superset/pull/8037#discussion_r314099639
 
 

 ##########
 File path: superset/views/core.py
 ##########
 @@ -2398,7 +2398,13 @@ def results(self, key):
                 status=410,
             )
 
-        query = db.session.query(Query).filter_by(results_key=key).one()
+        query = 
db.session.query(Query).filter_by(results_key=key).one_or_none()
+        if query is None:
+            return json_error_response(
+                "Data could not be retrieved. You may want to re-run the 
query.",
+                status=410,
 
 Review comment:
   I was debating whether to use 404, which I think fits better, or 410 like a 
previous similar error message used. I'll use 404 to make it easier to 
differentiate.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to