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 2020/09/05 12:37:15 UTC
[GitHub] [incubator-superset] pkshr opened a new issue #10802: TypeError: unhashable type: 'dict' - Dashboard
pkshr opened a new issue #10802:
URL: https://github.com/apache/incubator-superset/issues/10802
I have a query that is executed against athena. The result is a table with 3 columns - Account, DayOfYear and Cost. I am trying to send this as a stacked bar chart to the dashboard. The dashboard has only this chart and it throws 500 internal server error.
`Exception on /superset/dashboard/7/ [GET]
Traceback (most recent call last):
File "/root/venv/lib64/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/root/venv/lib64/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/root/venv/lib64/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/root/venv/lib64/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/root/venv/lib64/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/root/venv/lib64/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/root/venv/lib64/python3.6/site-packages/flask_appbuilder/security/decorators.py", line 109, in wraps
return f(self, *args, **kwargs)
File "/root/venv/lib64/python3.6/site-packages/superset/views/core.py", line 1616, in dashboard
for datasource, slices in datasources.items()
File "/root/venv/lib64/python3.6/site-packages/superset/views/core.py", line 1616, in <dictcomp>
for datasource, slices in datasources.items()
File "/root/venv/lib64/python3.6/site-packages/superset/connectors/base/models.py", line 285, in data_for_slices
metric_names.add(utils.get_metric_name(metric))
TypeError: unhashable type: 'dict'
ERROR:superset.app:Exception on /superset/dashboard/7/ [GET]
Traceback (most recent call last):
File "/root/venv/lib64/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/root/venv/lib64/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/root/venv/lib64/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/root/venv/lib64/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/root/venv/lib64/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/root/venv/lib64/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/root/venv/lib64/python3.6/site-packages/flask_appbuilder/security/decorators.py", line 109, in wraps
return f(self, *args, **kwargs)
File "/root/venv/lib64/python3.6/site-packages/superset/views/core.py", line 1616, in dashboard
for datasource, slices in datasources.items()
File "/root/venv/lib64/python3.6/site-packages/superset/views/core.py", line 1616, in <dictcomp>
for datasource, slices in datasources.items()
File "/root/venv/lib64/python3.6/site-packages/superset/connectors/base/models.py", line 285, in data_for_slices
metric_names.add(utils.get_metric_name(metric))
TypeError: unhashable type: 'dict'
INFO:werkzeug:192.168.1.235 - - [05/Sep/2020 08:36:06] "GET /superset/dashboard/7/ HTTP/1.1" 500 -`
### Environment
`CentOS Linux release 7.8.2003 (Core) - Linux 3.10.0-1127.el7.x86_64`
- superset version: `Superset 0.37.0`
- python version: `Python 3.6.9`
- node.js version: `-bash: node: command not found`
- npm version: `-bash: npm: command not found`
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] natbusa commented on issue #10802: TypeError: unhashable type: 'dict' - Dashboard
Posted by GitBox <gi...@apache.org>.
natbusa commented on issue #10802:
URL: https://github.com/apache/incubator-superset/issues/10802#issuecomment-689938947
```
def get_metric_name(metric: Metric) -> str:
fallback = metric
if isinstance(metric, dict):
fallback = metric.get('label', metric['optionName'])
return metric["label"] if is_adhoc_metric(metric) else fallback # type: ignore
```
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] villebro commented on issue #10802: TypeError: unhashable type: 'dict' - Dashboard
Posted by GitBox <gi...@apache.org>.
villebro commented on issue #10802:
URL: https://github.com/apache/incubator-superset/issues/10802#issuecomment-687605856
thanks for reporting @pkshr , I'll look into this.
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] natbusa edited a comment on issue #10802: TypeError: unhashable type: 'dict' - Dashboard
Posted by GitBox <gi...@apache.org>.
natbusa edited a comment on issue #10802:
URL: https://github.com/apache/incubator-superset/issues/10802#issuecomment-689938947
Sometimes the get_metric_name produces a dictionary rather than a string.
Here below a possible mitigation of the problem
```
def get_metric_name(metric: Metric) -> str:
name = metric
if isinstance(metric, dict):
name = metric.get('label', metric['optionName'])
return metric["label"] if is_adhoc_metric(metric) else name # type: ignore
```
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] natbusa edited a comment on issue #10802: TypeError: unhashable type: 'dict' - Dashboard
Posted by GitBox <gi...@apache.org>.
natbusa edited a comment on issue #10802:
URL: https://github.com/apache/incubator-superset/issues/10802#issuecomment-689938947
Sometimes the get_metric_name produces a dictionary rather than a string.
Here below a possible mitigation of the problem
```
def get_metric_name(metric: Metric) -> str:
fallback = metric
if isinstance(metric, dict):
fallback = metric.get('label', metric['optionName'])
return metric["label"] if is_adhoc_metric(metric) else fallback # type: ignore
```
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] issue-label-bot[bot] commented on issue #10802: TypeError: unhashable type: 'dict' - Dashboard
Posted by GitBox <gi...@apache.org>.
issue-label-bot[bot] commented on issue #10802:
URL: https://github.com/apache/incubator-superset/issues/10802#issuecomment-687605137
Issue-Label Bot is automatically applying the label `#bug` to this issue, with a confidence of 0.71. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: [app homepage](https://github.com/marketplace/issue-label-bot), [dashboard](https://mlbot.net/data/apache/incubator-superset) and [code](https://github.com/hamelsmu/MLapp) for this bot.
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] natbusa edited a comment on issue #10802: TypeError: unhashable type: 'dict' - Dashboard
Posted by GitBox <gi...@apache.org>.
natbusa edited a comment on issue #10802:
URL: https://github.com/apache/incubator-superset/issues/10802#issuecomment-689938947
Sometimes the get_metric_name produces a dictionary rather than a string.
Here below a possible mitigation of the problem change the following in `superset/utils/core.py`
```
def get_metric_name(metric: Metric) -> str:
name = metric
if isinstance(metric, dict):
name = metric.get('label', metric['optionName'])
return metric["label"] if is_adhoc_metric(metric) else name # type: ignore
```
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] stale[bot] commented on issue #10802: TypeError: unhashable type: 'dict' - Dashboard
Posted by GitBox <gi...@apache.org>.
stale[bot] commented on issue #10802:
URL: https://github.com/apache/incubator-superset/issues/10802#issuecomment-734495349
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue `.pinned` to prevent stale bot from closing the issue.
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] natbusa commented on issue #10802: TypeError: unhashable type: 'dict' - Dashboard
Posted by GitBox <gi...@apache.org>.
natbusa commented on issue #10802:
URL: https://github.com/apache/incubator-superset/issues/10802#issuecomment-689948233
Or you could do a similar fix in the `is_adhoc_metric` function ...
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] natbusa edited a comment on issue #10802: TypeError: unhashable type: 'dict' - Dashboard
Posted by GitBox <gi...@apache.org>.
natbusa edited a comment on issue #10802:
URL: https://github.com/apache/incubator-superset/issues/10802#issuecomment-689938947
Sometimes the get_metric_name produces a dictionary rather than a string.
Here below a possible mitigation of the problem change the following in `superset/utils/core.py`
```
def get_metric_name(metric: Metric) -> str:
return metric["label"] if (is_adhoc_metric(metric) or isinstance(metric, dict)) else metric # type: ignore
```
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] pkshr commented on issue #10802: TypeError: unhashable type: 'dict' - Dashboard
Posted by GitBox <gi...@apache.org>.
pkshr commented on issue #10802:
URL: https://github.com/apache/incubator-superset/issues/10802#issuecomment-687608150
@villebro Thank you. FYI, I tried adding metric in the table as mentioned in https://github.com/apache/incubator-superset/issues/8041 . The issue still persists.
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] natbusa edited a comment on issue #10802: TypeError: unhashable type: 'dict' - Dashboard
Posted by GitBox <gi...@apache.org>.
natbusa edited a comment on issue #10802:
URL: https://github.com/apache/incubator-superset/issues/10802#issuecomment-689938947
Sometimes the get_metric_name produces a dictionary rather than a string.
Here below a possible mitigation of the problem change the following in `superset/utils/core.py`
```
def get_metric_name(metric: Metric) -> str:
has_label = isinstance(metric, dict) and ("label" in metric.keys())
return metric["label"] if is_adhoc_metric(metric) or has_label else metric # type: ignore
```
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] natbusa edited a comment on issue #10802: TypeError: unhashable type: 'dict' - Dashboard
Posted by GitBox <gi...@apache.org>.
natbusa edited a comment on issue #10802:
URL: https://github.com/apache/incubator-superset/issues/10802#issuecomment-689938947
Sometimes the get_metric_name produces a dictionary rather than a string.
Here below a possible mitigation of the problem change the following in `superset/utils/core.py`
```
def get_metric_name(metric: Metric) -> str:
name = metric
if isinstance(metric, dict):
name = metric.get('label')
return metric["label"] if is_adhoc_metric(metric) else name # type: ignore
```
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org