mirror of
https://github.com/apache/superset.git
synced 2026-04-20 08:34:37 +00:00
fix(chart-data-api): improve chart data endpoint errors (#10300)
* fix: improve chart data error response * Populate error_message in QueryResult * add tests * Lint + fix incorrect raise * add more tests
This commit is contained in:
@@ -111,8 +111,7 @@ class QueryContext:
|
||||
self.df_metrics_to_num(df, query_object)
|
||||
|
||||
df.replace([np.inf, -np.inf], np.nan)
|
||||
|
||||
df = query_object.exec_post_processing(df)
|
||||
df = query_object.exec_post_processing(df)
|
||||
|
||||
return {
|
||||
"query": result.query,
|
||||
@@ -160,10 +159,7 @@ class QueryContext:
|
||||
df = payload["df"]
|
||||
status = payload["status"]
|
||||
if status != utils.QueryStatus.FAILED:
|
||||
if df.empty:
|
||||
payload["error"] = "No data"
|
||||
else:
|
||||
payload["data"] = self.get_data(df)
|
||||
payload["data"] = self.get_data(df)
|
||||
del payload["df"]
|
||||
if self.result_type == utils.ChartDataResultType.RESULTS:
|
||||
return {"data": payload["data"]}
|
||||
|
||||
Reference in New Issue
Block a user