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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]