Fixes#36072 where SQL Lab queries with WHERE clauses failed with
"Database error: Not acceptable" in Superset v4.1+.
Root cause: Flask 2.3+ (upgraded in v4.1.0) has stricter content
negotiation that could return HTTP 406 when Content-Type headers
aren't explicitly set, particularly with ENABLE_PROXY_FIX or certain
Accept header configurations.
Changes:
- Add explicit Content-Type headers to /api/v1/sqllab/execute/ and
/api/v1/sqllab/results/ endpoints
- Improve error handling with try-except blocks for result fetching
and JSON serialization
- Add targeted integration test for WHERE clause queries
The fix ensures Flask 2.3+ doesn't attempt content negotiation that
could fail, while maintaining backward compatibility.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>