GitHub user Ruchitha598 added a comment to the discussion: Unable to Retrieve the query_context Through API After Chart Creation Without Loading Chart in UI?
Hi @dosu We are trying to generate the chart data using the this api endpoint curl -X POST 'http://10.0.11.179:8089/api/v1/chart/data' \ --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6dHJ1ZSwiaWF0IjoxNzU1NTAwNTc3LCJqdGkiOiI3NGQ4NTBiOS05YzFkLTQ5MGEtYTdkZi0wZWM0NTJhM2VkYmUiLCJ0eXBlIjoiYWNjZXNzIiwic3ViIjoiMSIsIm5iZiI6MTc1NTUwMDU3NywiY3NyZiI6ImRkMTE3ZTVlLTA2YWYtNDRlZC1hN2RlLTQxN2E0NDFkN2Q5NyIsImV4cCI6MTc1NTUwMTQ3N30.c29QTNUZp80CQO08t5RuoEAFpnkecWbzP38zT-xoS84' \ --header "Content-Type: application/json" \ --data '{ "datasource": { "id": 1, "type": "table" }, "force": false, "queries": [ { "filters": [], "extras": { "having": "", "where": "" }, "applied_time_extras": {}, "columns": [ { "columnType": "BASE_AXIS", "sqlExpression": "CAMPAIGN_NAME", "label": "CAMPAIGN_NAME", "expressionType": "SQL" } ], "metrics": [ { "expressionType": "SQL", "sqlExpression": "SUM(PUSHED_COUNT)" } ], "orderby": [ [ { "expressionType": "SQL", "sqlExpression": "SUM(PUSHED_COUNT)" }, false ] ], "annotation_layers": [], "row_limit": 1000, "series_columns": [], "series_limit": 0, "order_desc": true, "url_params": {}, "custom_params": {}, "custom_form_data": {}, "time_offsets": [], "post_processing": [ { "operation": "pivot", "options": { "index": ["CAMPAIGN_NAME"], "columns": [], "aggregates": { "SUM(PUSHED_COUNT)": { "operator": "mean" } }, "drop_missing_columns": true } }, { "operation": "flatten" } ] } ], "form_data": { "adhoc_filters": [], "all_columns": [], "color_scheme": "supersetColors", "datasource": "1__table", "groupby": [], "metrics": [ { "expressionType": "SQL", "sqlExpression": "SUM(PUSHED_COUNT)" } ], "order_desc": true, "row_limit": "1000", "slice_id": 597, "slice_name": "Campaign Report", "timeseries_limit_metric": null, "viz_type": "echarts_timeseries_bar", "xAxisLabelRotation": 45, "x_axis": "CAMPAIGN_NAME", "x_axis_time_format": "%d/%m/%Y", "force": false, "result_format": "json", "result_type": "full" }, "result_format": "json", "result_type": "full" }' As a response we are getting thses details: { "result": [ { "cache_key": "73f521f22a4cd22580a280b35c0c2a26", "cached_dttm": null, "cache_timeout": 86400, "applied_template_filters": [], "annotation_data": {}, "error": null, "is_cached": null, "query": "SELECT \"CAMPAIGN_NAME\" AS \"CAMPAIGN_NAME\", SUM(PUSHED_COUNT) AS \"SUM(PUSHED_COUNT)\" \nFROM \"demo\".\"CTD_COMMON\" GROUP BY \"CAMPAIGN_NAME\" ORDER BY \"SUM(PUSHED_COUNT)\" DESC\n LIMIT 1000;\n\n", "status": "success", "stacktrace": null, "rowcount": 6, "sql_rowcount": 6, "from_dttm": null, "to_dttm": null, "label_map": { "CAMPAIGN_NAME": [ "CAMPAIGN_NAME" ], "SUM(PUSHED_COUNT)": [ "SUM(PUSHED_COUNT)" ] }, "colnames": [ "CAMPAIGN_NAME", "SUM(PUSHED_COUNT)" ], "indexnames": [ 0, 1, 2, 3, 4, 5 ], "coltypes": [ 1, 0 ], "data": [ { "CAMPAIGN_NAME": "Airport Campaign", "SUM(PUSHED_COUNT)": 293 }, { "CAMPAIGN_NAME": "Hayyak_PostRenewal_2024", "SUM(PUSHED_COUNT)": 559 }, { "CAMPAIGN_NAME": "Hayyak_PreRenewal_2024", "SUM(PUSHED_COUNT)": 827 }, { "CAMPAIGN_NAME": "IDD ATL Campaign", "SUM(PUSHED_COUNT)": 429 }, { "CAMPAIGN_NAME": "Prepaid IDD BTL", "SUM(PUSHED_COUNT)": 971 }, { "CAMPAIGN_NAME": "VAS_CAMPAIGN", "SUM(PUSHED_COUNT)": 653 } ], "result_format": "json", "applied_filters": [], "rejected_filters": [] } ] } So to generate the above response we need pass query context as a payload . Is there is any alternative api endpoint to generate the above response without needing to use query_context in the payload GitHub link: https://github.com/apache/superset/discussions/34750#discussioncomment-14160732 ---- This is an automatically sent email for notifications@superset.apache.org. To unsubscribe, please send an email to: notifications-unsubscr...@superset.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org