Skip to content

Commit

Permalink
[bugfix] markup and iframe viz raise 'Empty query' (apache#4225)
Browse files Browse the repository at this point in the history
closes apache#4222

Related to: apache#4016
  • Loading branch information
mistercrunch authored Jan 17, 2018
1 parent ff162c6 commit ba9ed18
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 1 addition & 2 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,8 +1035,7 @@ def generate_json(self, datasource_type, datasource_id, form_data,
return self.get_query_string_response(viz_obj)

try:
payload = viz_obj.get_payload(
force=force)
payload = viz_obj.get_payload(force=force)
except Exception as e:
logging.exception(e)
return json_error_response(utils.error_msg_from_exception(e))
Expand Down
14 changes: 10 additions & 4 deletions superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,12 @@ def cache_key(self, query_obj):
def get_payload(self, force=False):
"""Handles caching around the json payload retrieval"""
query_obj = self.query_obj()
cache_key = self.cache_key(query_obj)
cache_key = self.cache_key(query_obj) if query_obj else None
cached_dttm = None
data = None
stacktrace = None
rowcount = None
if not force and cache:
if cache_key and cache and not force:
cache_value = cache.get(cache_key)
if cache_value:
stats_logger.incr('loaded_from_cache')
Expand Down Expand Up @@ -536,7 +536,10 @@ class MarkupViz(BaseViz):
verbose_name = _('Markup')
is_timeseries = False

def get_df(self):
def query_obj(self):
return None

def get_df(self, query_obj=None):
return None

def get_data(self, df):
Expand Down Expand Up @@ -1573,7 +1576,10 @@ class IFrameViz(BaseViz):
credits = 'a <a href="https://github.com/airbnb/superset">Superset</a> original'
is_timeseries = False

def get_df(self):
def query_obj(self):
return None

def get_df(self, query_obj=None):
return None


Expand Down

0 comments on commit ba9ed18

Please sign in to comment.