You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "dosubot[bot] (via GitHub)" <gi...@apache.org> on 2026/05/02 03:14:05 UTC
Re: [D] Compilation of query data for a POST request [superset]
GitHub user dosubot[bot] edited a comment on the discussion: Compilation of query data for a POST request
<!-- Answer -->
To build a multi-level X-axis with `ds` and `TAXI_OUT`, you need to include both columns in the `columns` array of your query. Here's an example POST request to `/api/v1/chart/data`:
```json
{
"datasource": {"id": YOUR_DATASOURCE_ID, "type": "table"},
"queries": [{
"columns": ["ds", "TAXI_OUT"],
"metrics": [{"label": "your_metric"}],
"row_limit": 1000,
"time_range": "Last year",
"post_processing": []
}],
"result_type": "results"
}
```
With `result_type: "results"`, the response will return a simplified structure with just your data:
```json
{
"data": [...],
"colnames": ["ds", "TAXI_OUT", ...],
"coltypes": [...],
"rowcount": 100
}
```
For `post_processing`, if you don't need additional transformations, you can leave it as an empty array `[]`. If you need to transform the data further, available operations include `aggregate`, `sort`, `pivot`, `rolling`, etc. For example, to sort by `ds`:
```json
"post_processing": [{
"operation": "sort",
"options": {
"by": ["ds"],
"ascending": [true]
}
}]
```
The order of columns in the `columns` array determines the hierarchy - so `["ds", "TAXI_OUT"]` creates a [two-level grouping](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/models/helpers.py#L1614-L1653) where data is first grouped by `ds`, then by `TAXI_OUT`.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).*
---
Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=apache%2Fsuperset).
[](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=apache%2Fsuperset&message_id=76c32625-4fb7-43bc-8a5d-0c4c627a775e) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=apache%2Fsuperset)
GitHub link: https://github.com/apache/superset/discussions/38011#discussioncomment-15823324
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org