You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/08/22 19:32:15 UTC
[GitHub] HectorLira opened a new issue #5700: Error when trying to visualize
'Time Series - Line Chart' -- Error message is unclear
HectorLira opened a new issue #5700: Error when trying to visualize 'Time Series - Line Chart' -- Error message is unclear
URL: https://github.com/apache/incubator-superset/issues/5700
Make sure these boxes are checked before submitting your issue - thank you!
- [ ] 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
- [ ] I have checked the issue tracker for the same issue and I haven't found one similar
### Superset version
0.26.3
### Expected results
Time Series - Line Chart rendered.
### Actual results
Error with no clear message.
### Steps to reproduce
1. Create a query in SQL Lab with a datetime column and an integer column (or just use any datasource that has a datetime column and group by that column to count the number of rows)
2. Click on 'Explore' to visualize the resulting table

3. Choose Time Series - Line Chart as an option to visualize
4. Add your integer column as value for the 'Metrics' option
5. Click on 'Run Query'

Here is the trackeback I get
`Traceback (most recent call last):
File "/home/work/incubator-superset/superset/views/core.py", line 1115, in generate_json
payload = viz_obj.get_payload()
File "/home/work/incubator-superset/superset/viz.py", line 347, in get_payload
payload['data'] = self.get_data(df)
File "/home/work/incubator-superset/superset/viz.py", line 1217, in get_data
df = self.process_data(df)
File "/home/work/incubator-superset/superset/viz.py", line 1137, in process_data
values=utils.get_metric_names(fd.get('metrics')))
File "/usr/local/lib/python3.6/site-packages/pandas/core/frame.py", line 5303, in pivot_table
margins_name=margins_name)
File "/usr/local/lib/python3.6/site-packages/pandas/core/reshape/pivot.py", line 61, in pivot_table
raise KeyError(i)
KeyError: 'SUM(total_visits)'`
The traceback doesn't seem to be helpful.
This is the query that is generated automatically to visualize the resulting table:
`SELECT weekly AS __timestamp,
SUM(total_visits) AS "SUM(total_visits)"
FROM
(SELECT DATE_TRUNC('WEEK', "timestamp") weekly,
COUNT(*) total_visits
FROM my_table
WHERE "timestamp" >= '2018-06-01'
GROUP BY 1) AS expr_qry
WHERE weekly >= '1918-08-22 00:00:00'
GROUP BY weekly
ORDER BY "SUM(total_visits)" DESC
LIMIT 50000;`
I've tried the following to see if it works:
- grouping the data by the column 'weekly' in the 'Query' options,
- adding a value for Time Grain,
- trying to visualize using both Chrome and Mozilla Firefox,
- using a different time column in the table to see if there was any conflict caused by the name of the column being 'timestamp'
- changing the 'Metrics' definition from 'SUM(total_visits)' to 'total_visits' -> This produces another message:


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org