Mapbox isn't working on Druid
Make sure these boxes are checked before submitting your issue - thank you!
- [x] I have checked the superset logs for python stacktraces and included it here as text if any
- [ ] I have reproduced the issue with at least the latest released version of superset
- [x] I have checked the issue tracker for the same issue and I haven't found one similar
Superset version
0.21
Expected results
A map
Actual results
Traceback (most recent call last):
File "/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/viz.py", line 276, in get_payload
df = self.get_df()
File "/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/viz.py", line 98, in get_df
self.results = self.datasource.query(query_obj)
File "/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py", line 1145, in query
client=client, query_obj=query_obj, phase=2)
File "/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py", line 933, in get_query_str
return self.run_query(client=client, phase=phase, **query_obj)
File "/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py", line 995, in run_query
metrics_dict)
File "/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py", line 892, in metrics_and_post_aggs
if metrics_dict[metric_name].metric_type != 'postagg':
KeyError: None
Steps to reproduce
Choose World Map as the viz type. Select the dimension containing the country code (in my case ISO alpha 2).
Is this a build from git or a release? In the first case the git hash is more helpful than the version written in the source.
I built from git, but I don't know exactly how to find the hash. I looked at my fork and the last pull from the main repo looks like commit 5bc734b2e5ec4e15653f68a99d831f6a991adacf
Looks like a problem around handling a Druid postaggregation that references a metric or post agg that doesn't exist. Would be nice to handle that error better.
How could that happen? I am not able to select metrics that doesn't exist. Also I am using the default COUNT(*) metric.
Mind sharing your JSON? I'm guessing there's a reference that doesn't line up somehow
{"status": "failed", "stacktrace": "Traceback (most recent call last):\n File \"/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/viz.py\", line 276, in get_payload\n df = self.get_df()\n File \"/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/viz.py\", line 98, in get_df\n self.results = self.datasource.query(query_obj)\n File \"/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py\", line 1145, in query\n client=client, query_obj=query_obj, phase=2)\n File \"/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py\", line 933, in get_query_str\n return self.run_query(client=client, phase=phase, **query_obj)\n File \"/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py\", line 995, in run_query\n metrics_dict)\n File \"/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py\", line 892, in metrics_and_post_aggs\n if metrics_dict[metric_name].metric_type != 'postagg':\nKeyError: None\n", "cached_dttm": "2018-02-08T15:15:05", "is_cached": false, "query": "", "cache_timeout": 86400, "data": null, "error": "None", "form_data": {"show_bubbles": false, "viz_type": "world_map", "having_filters": [], "metric": "count", "since": "7 days ago", "entity": "targets_geo_country_code", "druid_time_origin": null, "country_fieldtype": "cca2", "datasource": "2__druid", "filters": [], "granularity": "one day", "secondary_metric": null, "until": "now", "max_bubble_size": "25"}, "cache_key": "a9c07ee3943383be73254cb35af81543", "annotations": []}
I meant the JSON expression for your post aggregation definition, also not that you can use triple backticks for better multi line rendering on github ```
I am not using a post agg. I am using COUNT(*)
Hey @SpyderRivera I think the problem you were experiencing was that the "Bubble Size" dropdown in the "Bubbles" section is required. When it isn't selected, None is passed as the secondary metric which results in the KeyError you see in the stack trace. The current version of Superset enforces this with a validation requiring the dropdown to be selected but if you haven't upgraded, you should be able to see the map if you select the dropdown (whether the "Show Bubbles" box is checked or not).
This works in the latest version! Thanks!