bito-code-review[bot] commented on PR #44624:
URL: https://github.com/apache/superset/pull/44624#issuecomment-5824451185
<!-- Bito Reply -->
The flagged issue is correct. By bypassing `command.execute()` in the new
streaming path, the code skips the error handling logic (such as
`ChartDataQueryFailedError` and cache-error mapping) that is normally triggered
during execution.
To resolve this, you should wrap the streaming call in a `try-except` block
that mirrors the error handling in the standard execution path.
### Proposed Fix
In `superset/charts/data/api.py`, update the `_get_data_response` method to
include error handling for the streaming path:
```python
if not self._has_export_permission():
return self.response_403()
try:
return self._create_streaming_csv_response(
{"query_context": query_context},
form_data,
filename=filename,
expected_rows=expected_rows,
slice_=slice_ or query_context.slice_,
)
except ChartDataQueryFailedError as exc:
return self.response_400(message=str(exc))
```
Would you like me to fetch all other comments on this PR to validate and
implement fixes for them as well?
**superset/charts/data/api.py**
```
try:
return self._create_streaming_csv_response(
{"query_context": query_context},
form_data,
filename=filename,
expected_rows=expected_rows,
slice_=slice_ or query_context.slice_,
)
except ChartDataQueryFailedError as exc:
return self.response_400(message=str(exc))
```
--
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]