You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "HAsaad7 (via GitHub)" <gi...@apache.org> on 2023/09/10 10:15:41 UTC
[GitHub] [superset] HAsaad7 opened a new issue, #25246: create chart api
HAsaad7 opened a new issue, #25246:
URL: https://github.com/apache/superset/issues/25246
A clear and concise description of what the bug is.
DB engine Error
unhashable type: 'list'
This may be triggered by:
Issue 1011 - Superset encountered an unexpected error.
Please reach out to the Chart Owner for assistance.
Chart Owner: Superset Admin
#### How to reproduce the bug
1. using python code
2. Create the payload [{'table': 'channels', 'columns': ['topic__creator', 'topic__value'], 'chart': {'viz_type': 'funnel', 'properties': {'name': ' Department', 'params': {'groupby': 'topic__creator', 'metric': [{'expressionType': 'SIMPLE', 'column': {'column_name': 'topic__value'}, 'aggregate': 'MAX', 'label': 'MAX(topic__value)'}]}}}}]
3. send it by an endpoint req.
4. See error
### Expected results
chart created successfully
what you expected to happen.
open the localhost and found my chart
what actually happens.
engine Error
unhashable type: 'list'
This may be triggered by:
Issue 1011 -
2023-09-10 12:05:16 Traceback (most recent call last):
2023-09-10 12:05:16 File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1823, in full_dispatch_request
2023-09-10 12:05:16 rv = self.dispatch_request()
2023-09-10 12:05:16 File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request
2023-09-10 12:05:16 return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
2023-09-10 12:05:16 File "/usr/local/lib/python3.9/site-packages/flask_appbuilder/security/decorators.py", line 95, in wraps
2023-09-10 12:05:16 return f(self, *args, **kwargs)
2023-09-10 12:05:16 File "/app/superset/views/base_api.py", line 127, in wraps
2023-09-10 12:05:16 raise ex
2023-09-10 12:05:16 File "/app/superset/views/base_api.py", line 121, in wraps
2023-09-10 12:05:16 duration, response = time_function(f, self, *args, **kwargs)
2023-09-10 12:05:16 File "/app/superset/utils/core.py", line 1525, in time_function
2023-09-10 12:05:16 response = func(*args, **kwargs)
2023-09-10 12:05:16 File "/app/superset/utils/log.py", line 255, in wrapper
2023-09-10 12:05:16 value = f(*args, **kwargs)
2023-09-10 12:05:16 File "/app/superset/charts/data/api.py", line 258, in data
2023-09-10 12:05:16 return self._get_data_response(
2023-09-10 12:05:16 File "/app/superset/charts/data/api.py", line 418, in _get_data_response
2023-09-10 12:05:16 result = command.run(force_cached=force_cached)
2023-09-10 12:05:16 File "/app/superset/charts/data/commands/get_data_command.py", line 45, in run
2023-09-10 12:05:16 payload = self._query_context.get_payload(
2023-09-10 12:05:16 File "/app/superset/common/query_context.py", line 100, in get_payload
2023-09-10 12:05:16 return self._processor.get_payload(cache_query_context, force_cached)
2023-09-10 12:05:16 File "/app/superset/common/query_context_processor.py", line 588, in get_payload
2023-09-10 12:05:16 query_results = [
2023-09-10 12:05:16 File "/app/superset/common/query_context_processor.py", line 589, in <listcomp>
2023-09-10 12:05:16 get_query_results(
2023-09-10 12:05:16 File "/app/superset/common/query_actions.py", line 225, in get_query_results
2023-09-10 12:05:16 return result_func(query_context, query_obj, force_cached)
2023-09-10 12:05:16 File "/app/superset/common/query_actions.py", line 103, in _get_full
2023-09-10 12:05:16 payload = query_context.get_df_payload(query_obj, force_cached=force_cached)
2023-09-10 12:05:16 File "/app/superset/common/query_context.py", line 121, in get_df_payload
2023-09-10 12:05:16 return self._processor.get_df_payload(
2023-09-10 12:05:16 File "/app/superset/common/query_context_processor.py", line 157, in get_df_payload
2023-09-10 12:05:16 query_result = self.get_query_result(query_obj)
2023-09-10 12:05:16 File "/app/superset/common/query_context_processor.py", line 235, in get_query_result
2023-09-10 12:05:16 result = query_context.datasource.query(query_object.to_dict())
2023-09-10 12:05:16 File "/app/superset/connectors/sqla/models.py", line 1178, in query
2023-09-10 12:05:16 query_str_ext = self.get_query_str_extended(query_obj)
2023-09-10 12:05:16 File "/app/superset/connectors/sqla/models.py", line 842, in get_query_str_extended
2023-09-10 12:05:16 sqlaq = self.get_sqla_query(**query_obj)
2023-09-10 12:05:16 File "/app/superset/models/helpers.py", line 1561, in get_sqla_query
2023-09-10 12:05:16 elif col in columns_by_name:
2023-09-10 12:05:16 TypeError: unhashable type: 'list'
2023-09-10 12:05:16 2023-09-10 10:05:16,512:ERROR:superset.views.base:unhashable type: 'list'
2023-09-10 12:05:16 Traceback (most recent call last):
2023-09-10 12:05:16 File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1823, in full_dispatch_request
2023-09-10 12:05:16 rv = self.dispatch_request()
2023-09-10 12:05:16 File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request
2023-09-10 12:05:16 return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
2023-09-10 12:05:16 File "/usr/local/lib/python3.9/site-packages/flask_appbuilder/security/decorators.py", line 95, in wraps
2023-09-10 12:05:16 return f(self, *args, **kwargs)
2023-09-10 12:05:16 File "/app/superset/views/base_api.py", line 127, in wraps
2023-09-10 12:05:16 raise ex
2023-09-10 12:05:16 File "/app/superset/views/base_api.py", line 121, in wraps
2023-09-10 12:05:16 duration, response = time_function(f, self, *args, **kwargs)
2023-09-10 12:05:16 File "/app/superset/utils/core.py", line 1525, in time_function
2023-09-10 12:05:16 response = func(*args, **kwargs)
2023-09-10 12:05:16 File "/app/superset/utils/log.py", line 255, in wrapper
2023-09-10 12:05:16 value = f(*args, **kwargs)
2023-09-10 12:05:16 File "/app/superset/charts/data/api.py", line 258, in data
2023-09-10 12:05:16 return self._get_data_response(
2023-09-10 12:05:16 File "/app/superset/charts/data/api.py", line 418, in _get_data_response
2023-09-10 12:05:16 result = command.run(force_cached=force_cached)
2023-09-10 12:05:16 File "/app/superset/charts/data/commands/get_data_command.py", line 45, in run
2023-09-10 12:05:16 payload = self._query_context.get_payload(
2023-09-10 12:05:16 File "/app/superset/common/query_context.py", line 100, in get_payload
2023-09-10 12:05:16 return self._processor.get_payload(cache_query_context, force_cached)
2023-09-10 12:05:16 File "/app/superset/common/query_context_processor.py", line 588, in get_payload
2023-09-10 12:05:16 query_results = [
2023-09-10 12:05:16 File "/app/superset/common/query_context_processor.py", line 589, in <listcomp>
2023-09-10 12:05:16 get_query_results(
2023-09-10 12:05:16 File "/app/superset/common/query_actions.py", line 225, in get_query_results
2023-09-10 12:05:16 return result_func(query_context, query_obj, force_cached)
2023-09-10 12:05:16 File "/app/superset/common/query_actions.py", line 103, in _get_full
2023-09-10 12:05:16 payload = query_context.get_df_payload(query_obj, force_cached=force_cached)
2023-09-10 12:05:16 File "/app/superset/common/query_context.py", line 121, in get_df_payload
2023-09-10 12:05:16 return self._processor.get_df_payload(
2023-09-10 12:05:16 File "/app/superset/common/query_context_processor.py", line 157, in get_df_payload
2023-09-10 12:05:16 query_result = self.get_query_result(query_obj)
2023-09-10 12:05:16 File "/app/superset/common/query_context_processor.py", line 235, in get_query_result
2023-09-10 12:05:16 result = query_context.datasource.query(query_object.to_dict())
2023-09-10 12:05:16 File "/app/superset/connectors/sqla/models.py", line 1178, in query
2023-09-10 12:05:16 query_str_ext = self.get_query_str_extended(query_obj)
2023-09-10 12:05:16 File "/app/superset/connectors/sqla/models.py", line 842, in get_query_str_extended
2023-09-10 12:05:16 sqlaq = self.get_sqla_query(**query_obj)
2023-09-10 12:05:16 File "/app/superset/models/helpers.py", line 1561, in get_sqla_query
2023-09-10 12:05:16 elif col in columns_by_name:
2023-09-10 12:05:16 TypeError: unhashable type: 'list'
#### Screenshots

### Environment
superset docker
- browser type and version: firefox
- python version: `python --3.11`
### Checklist
Make sure to follow these steps before submitting your issue - thank you!
- [. ] I have checked the superset logs for python stacktraces and included it here as text if there are 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.
### Additional context
Add any other context about the problem here.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org
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
Re: [I] create chart api [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #25246:
URL: https://github.com/apache/superset/issues/25246#issuecomment-2767381223
Closing as stale, but happy to revisit/reopen if we can get some updated context here.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
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
Re: [I] create chart api [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #25246: create chart api
URL: https://github.com/apache/superset/issues/25246
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
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
Re: [I] create chart api [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #25246:
URL: https://github.com/apache/superset/issues/25246#issuecomment-2218723228
<!-- Greeting -->
Hey @rusackas! I'm here to help you with this issue. I'm Dosu, a bot that can assist you with bug fixes, answer questions, and guide you on becoming a contributor. Let me know how I can assist you!
<!-- Answer -->
To resolve the "unhashable type: 'list'" error when creating charts via the Superset API, ensure that the data being passed does not contain any lists in places where a hashable type (like a string or a number) is expected. This error typically occurs when a list is used as a key in a dictionary or in a set, which is not allowed because lists are mutable and thus unhashable.
In your payload, the `params` field should be a JSON string, not a dictionary containing lists. Here is an example of a corrected JSON payload:
```json
{
"table": "channels",
"columns": ["topic__creator", "topic__value"],
"chart": {
"viz_type": "funnel",
"properties": {
"name": "Department",
"params": "{\"groupby\": \"topic__creator\", \"metric\": [{\"expressionType\": \"SIMPLE\", \"column\": {\"column_name\": \"topic__value\"}, \"aggregate\": \"MAX\", \"label\": \"MAX(topic__value)\"}]}"
}
}
}
```
Ensure that the `params` field is a properly formatted JSON string. This should resolve the "unhashable type: 'list'" error.
Additionally, you can refer to the `ChartPostSchema` to understand the expected structure and types for each field. For instance, the `params` field is expected to be a JSON string, and the `owners` field is a list of integers <sup>[[1]](https://github.com/apache/superset/blob/master/superset/charts/api.py)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset/charts/schemas.py)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/superset/viz.py)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
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
Re: [I] create chart api [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #25246:
URL: https://github.com/apache/superset/issues/25246#issuecomment-2218708445
It's been a good long while since this was last touched. Anyone still facing this? If not, it'll be closed as stale.
Meanwhile, maybe @dosu-bot has some ideas here :)
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
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
Re: [I] create chart api [superset]
Posted by "Marchena27 (via GitHub)" <gi...@apache.org>.
Marchena27 commented on issue #25246:
URL: https://github.com/apache/superset/issues/25246#issuecomment-1958973505
Any news about that?
Exactly the same thing happens to me. If you change the metric and put it back, it looks like it should, but you can't automate if doing that.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
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