GitHub user dosubot[bot] added a comment to the discussion: Get dataset
description and columns description
<!-- Answer -->
To retrieve the actual physical value of `dataset_id` for passing to the
`df_to_excel` function when exporting chart data to Excel in Superset, you can
use the `ChartDataRestApi._map_form_data_datasource_to_dataset_id` method. This
method maps the form data's datasource to a dataset ID. Here's how you can use
it:
```python
response = ChartDataRestApi._map_form_data_datasource_to_dataset_id(
ChartDataRestApi, query_context_payload
)
dataset_id = response.get("dataset_id")
```
Ensure that your `query_context_payload` is correctly set up with the
appropriate datasource information. This method will return a dictionary
containing the `dataset_id` if available
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/jinja_context.py)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/tests/integration_tests/charts/data/api_tests.py)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
---
<sup>Help Dosu learn! Give it feedback: [Great
Response](https://app.dosu.dev/response-feedback/dc9aacf4-f781-4ba9-bbc0-479688e565b2?feedback_type=great_response)
| [Irrelevant
Answer](https://app.dosu.dev/response-feedback/dc9aacf4-f781-4ba9-bbc0-479688e565b2?feedback_type=irrelevant_answer)
| [Incorrect
Sources](https://app.dosu.dev/response-feedback/dc9aacf4-f781-4ba9-bbc0-479688e565b2?feedback_type=incorrect_sources)
| [Too
Verbose](https://app.dosu.dev/response-feedback/dc9aacf4-f781-4ba9-bbc0-479688e565b2?feedback_type=too_verbose)
|
[Hallucination](https://app.dosu.dev/response-feedback/dc9aacf4-f781-4ba9-bbc0-479688e565b2?feedback_type=hallucination)
| [Bug
Report](https://app.dosu.dev/response-feedback/dc9aacf4-f781-4ba9-bbc0-479688e565b2?feedback_type=bug_report)
|
[Other](https://app.dosu.dev/response-feedback/dc9aacf4-f781-4ba9-bbc0-479688e565b2?feedback_type=other)</sup>
GitHub link:
https://github.com/apache/superset/discussions/33504#discussioncomment-13189379
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]