superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: [explore] fix empty query message in 'View Query' (#4273)
Date Wed, 24 Jan 2018 21:14:41 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new b90c410  [explore] fix empty query message in 'View Query' (#4273)
b90c410 is described below

commit b90c410c01da3554d4c0cd62b1879873124b8d0f
Author: Maxime Beauchemin <maximebeauchemin@gmail.com>
AuthorDate: Wed Jan 24 13:14:38 2018 -0800

    [explore] fix empty query message in 'View Query' (#4273)
---
 superset/views/core.py | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/superset/views/core.py b/superset/views/core.py
index b06492c..db905f3 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -988,16 +988,22 @@ class Superset(BaseSupersetView):
         return redirect(endpoint)
 
     def get_query_string_response(self, viz_obj):
+        query = None
         try:
             query_obj = viz_obj.query_obj()
-            query = viz_obj.datasource.get_query_str(query_obj)
+            if query_obj:
+                query = viz_obj.datasource.get_query_str(query_obj)
         except Exception as e:
+            logging.exception(e)
             return json_error_response(e)
 
-        if query_obj['prequeries']:
+        if query_obj and query_obj['prequeries']:
             query_obj['prequeries'].append(query)
             query = ';\n\n'.join(query_obj['prequeries'])
-        query += ';'
+        if query:
+            query += ';'
+        else:
+            query = 'No query.'
 
         return Response(
             json.dumps({
@@ -1099,9 +1105,10 @@ class Superset(BaseSupersetView):
             force = request.args.get('force') == 'true'
             form_data = self.get_form_data()
         except Exception as e:
-                return json_error_response(
-                    utils.error_msg_from_exception(e),
-                    stacktrace=traceback.format_exc())
+            logging.exception(e)
+            return json_error_response(
+                utils.error_msg_from_exception(e),
+                stacktrace=traceback.format_exc())
         return self.generate_json(datasource_type=datasource_type,
                                   datasource_id=datasource_id,
                                   form_data=form_data,

-- 
To stop receiving notification emails like this one, please contact
maximebeauchemin@apache.org.

Mime
View raw message