rusackas opened a new pull request, #40644: URL: https://github.com/apache/superset/pull/40644
### SUMMARY Two small, low-risk correctness/consistency fixes: 1. **Consistent `Content-Type` in `Api.query`** (`superset/views/api.py`): the `Api.query()` endpoint returned a raw `json.dumps(...)` string, unlike its sibling handlers `query_form_data` and `time_range`, which use `self.json_response(...)`. Returning a bare string leaves the response `Content-Type` defaulting to `text/html` rather than `application/json`. Switched it to `return self.json_response(payload_json)`. `json_response` uses the same `json_int_dttm_ser` default serializer and `ignore_nan=True`, so the response body is equivalent — only the `Content-Type` header is now set consistently. 2. **Observable SQL dialect fallback** (`superset/sql/parse.py`): when parsing with the base dialect fails and the script contains backticks, the parser silently falls back to the MySQL dialect (to support backtick-quoted identifiers). Added a `logger.warning` on that branch so the fallback is observable. Parsing behavior is unchanged; only a log line is added (module `logger` already existed). ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Not applicable (backend-only change). ### TESTING INSTRUCTIONS - `python -m pytest tests/unit_tests/views/test_base.py tests/unit_tests/sql/parse_tests.py -q` (549 passed locally). - New `test_api_query_returns_json_content_type` asserts the `Api.query` response has an `application/json` content type. - New `test_backtick_fallback_logs_warning` asserts a warning is logged when the MySQL dialect fallback path is taken. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
