filippociceri opened a new issue #13812:
URL: https://github.com/apache/superset/issues/13812


   After updating to the latest version of superset (master), several BigNumber 
charts stop working. Note I am using BigQuery as a datasource.
   
   ### Expected results
   Charts displayed as in previous versions.
   
   ### Actual results
   Charts are no longer displayed. An error is shown instead, containing the 
name of the metric (with spaces). The following error is shown in superset logs 
when I try to access the chart:
   ```
   superset_1  | INFO:superset.viz:Cache key: 5bcc722ea51102014c910e2e3b8eae85
   superset_1  | 'Active users'
   superset_1  | Traceback (most recent call last):
   superset_1  |   File "/app/superset/views/base.py", line 183, in wraps
   superset_1  |     return f(self, *args, **kwargs)
   superset_1  |   File "/app/superset/utils/log.py", line 217, in wrapper
   superset_1  |     value = f(*args, **kwargs)
   superset_1  |   File "/app/superset/utils/cache.py", line 153, in wrapper
   superset_1  |     return f(*args, **kwargs)
   superset_1  |   File "/app/superset/views/utils.py", line 446, in wrapper
   superset_1  |     return f(*args, **kwargs)
   superset_1  |   File "/app/superset/views/core.py", line 618, in explore_json
   superset_1  |     return self.generate_json(viz_obj, response_type)
   superset_1  |   File "/app/superset/views/core.py", line 455, in 
generate_json
   superset_1  |     payload = viz_obj.get_payload()
   superset_1  |   File "/app/superset/viz.py", line 518, in get_payload
   superset_1  |     payload["data"] = self.get_data(df)
   superset_1  |   File "/app/superset/viz.py", line 1255, in get_data
   superset_1  |     aggfunc=np.min,  # looking for any (only) value, 
preserving `None`
   superset_1  |   File 
"/usr/local/lib/python3.7/site-packages/pandas/core/frame.py", line 7038, in 
pivot_table
   superset_1  |     observed=observed,
   superset_1  |   File 
"/usr/local/lib/python3.7/site-packages/pandas/core/reshape/pivot.py", line 89, 
in pivot_table
   superset_1  |     raise KeyError(i)
   superset_1  | KeyError: 'Active users'
   superset_1  | ERROR:superset.views.base:'Active users'
   superset_1  | Traceback (most recent call last):
   superset_1  |   File "/app/superset/views/base.py", line 183, in wraps
   superset_1  |     return f(self, *args, **kwargs)
   superset_1  |   File "/app/superset/utils/log.py", line 217, in wrapper
   superset_1  |     value = f(*args, **kwargs)
   superset_1  |   File "/app/superset/utils/cache.py", line 153, in wrapper
   superset_1  |     return f(*args, **kwargs)
   superset_1  |   File "/app/superset/views/utils.py", line 446, in wrapper
   superset_1  |     return f(*args, **kwargs)
   superset_1  |   File "/app/superset/views/core.py", line 618, in explore_json
   superset_1  |     return self.generate_json(viz_obj, response_type)
   superset_1  |   File "/app/superset/views/core.py", line 455, in 
generate_json
   superset_1  |     payload = viz_obj.get_payload()
   superset_1  |   File "/app/superset/viz.py", line 518, in get_payload
   superset_1  |     payload["data"] = self.get_data(df)
   superset_1  |   File "/app/superset/viz.py", line 1255, in get_data
   superset_1  |     aggfunc=np.min,  # looking for any (only) value, 
preserving `None`
   superset_1  |   File 
"/usr/local/lib/python3.7/site-packages/pandas/core/frame.py", line 7038, in 
pivot_table
   superset_1  |     observed=observed,
   superset_1  |   File 
"/usr/local/lib/python3.7/site-packages/pandas/core/reshape/pivot.py", line 89, 
in pivot_table
   superset_1  |     raise KeyError(i)
   superset_1  | KeyError: 'Active users'
   ```
   
   Modifying the metric's name by removing the spaces - `ActiveUsers`, 
effectively using camel case instead, displays the chart as expected. 
Inspecting the query, I can see that the label for my metric is mutated in the 
former case, while it stays the same in the latter.
   
   
   #### How to reproduce the bug
   
   1. Create a BigNumber chart using a BigQuery table as a datasource
   2. Add a metric with a space in the name (for example, `A B`)
   3. Click the Run button to generate a preview
   4. See error
   
   ### Environment
   
   (please complete the following information):
   
   - superset version: `1.0.0`
   - python version: `python --version`
   - node.js version: `node -v`
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included 
it here as text if there are any.
   - [x] 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.
   
   


-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to