You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
【6.0.0-RC2】Formatting the SQL in the "View Query" pop-up doesn't work #35682
The "original/formatted" toggle in the "View Query" pop-up doesn't work. It's stuck on "original". Clicking on the toggle gives an error (below) in Chrome console.
Note that it was working on "6.0.0rc1".
The error
9209.241e1adccfe51fea866f.entry.js:2 POST https://[DOMAIN-HIDDEN]/api/v1/sqllab/format_sql/ 400 (Bad Request)
n @ 9209.241e1adccfe51fea866f.entry.js:2
(anonymous) @ 9209.241e1adccfe51fea866f.entry.js:2
(anonymous) @ 9209.241e1adccfe51fea866f.entry.js:2
(anonymous) @ 2269.593775801f9ed22f060f.entry.js:1
u @ 2269.593775801f9ed22f060f.entry.js:1
request @ 2269.593775801f9ed22f060f.entry.js:1
await in request
post @ 2269.593775801f9ed22f060f.entry.js:1
post @ 2269.593775801f9ed22f060f.entry.js:1
(anonymous) @ 8fe7e097f8a517870d61.chunk.js:412
await in (anonymous)
onChange @ vendors.077cc2e3066bd62c36ac.entry.js:2
P @ 2483.ff4341ca7d28268597ab.entry.js:1
onClick @ 2483.ff4341ca7d28268597ab.entry.js:1
De @ vendors.077cc2e3066bd62c36ac.entry.js:2
Ue @ vendors.077cc2e3066bd62c36ac.entry.js:2
(anonymous) @ vendors.077cc2e3066bd62c36ac.entry.js:2
Or @ vendors.077cc2e3066bd62c36ac.entry.js:2
Er @ vendors.077cc2e3066bd62c36ac.entry.js:2
(anonymous) @ vendors.077cc2e3066bd62c36ac.entry.js:2
Re @ vendors.077cc2e3066bd62c36ac.entry.js:2
(anonymous) @ vendors.077cc2e3066bd62c36ac.entry.js:2
Pr @ vendors.077cc2e3066bd62c36ac.entry.js:2
Zt @ vendors.077cc2e3066bd62c36ac.entry.js:2
Qt @ vendors.077cc2e3066bd62c36ac.entry.js:2
t.unstable_runWithPriority @ 9209.241e1adccfe51fea866f.entry.js:2
Go @ vendors.077cc2e3066bd62c36ac.entry.js:2
Ie @ vendors.077cc2e3066bd62c36ac.entry.js:2
Kt @ vendors.077cc2e3066bd62c36ac.entry.js:2
Screenshots/recordings
Superset version
master / latest-dev
Python version
Not applicable
Node version
Not applicable
Browser
Chrome
Additional context
No response
Checklist
I have searched Superset docs and Slack and didn't find a solution to my problem.
I have searched the GitHub issue tracker and didn't find a similar bug report.
I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
This looks like a regression introduced between 6.0.0-RC1 and 6.0.0-RC2. The SQL formatting toggle in the "View Query" pop-up sends a POST request to /api/v1/sqllab/format_sql with a JSON payload containing the SQL string and the database engine. The backend strictly validates this payload and expects a non-empty sql field (string) and, optionally, an engine field (string or null) reference.
Recent changes to SQL formatting logic and input validation (notably in PRs #30578 and #30350) may have made the backend less tolerant of missing or malformed fields, or changed how the frontend retrieves the engine value reference. If the frontend is sending an undefined or invalid engine, or if the sql field is empty or missing, the backend will return a 400 error.
To troubleshoot, check the network request payload in your browser's dev tools and confirm both sql and engine are present and valid. If engine is undefined or the SQL is empty, that's likely the cause. This regression is likely due to stricter validation or a frontend change in how the engine is fetched from the dataset metadata.
The 400 error happens because the backend expects the engine field to be a string (like "bigquery"), not an object. The correct payload should look like:
{
"sql": "SELECT ...",
"engine": "bigquery"
}
This is enforced by the backend schema and confirmed in the frontend code, which should send engine as a string, not as { "backend": "bigquery" } (reference, backend schema). The regression likely comes from a recent frontend change that started passing the whole backend object instead of just the string. Updating the frontend to send only the backend string should resolve the issue.
Activity
dosubot commentedon Oct 16, 2025
This looks like a regression introduced between 6.0.0-RC1 and 6.0.0-RC2. The SQL formatting toggle in the "View Query" pop-up sends a POST request to
/api/v1/sqllab/format_sqlwith a JSON payload containing the SQL string and the database engine. The backend strictly validates this payload and expects a non-emptysqlfield (string) and, optionally, anenginefield (string or null) reference.Recent changes to SQL formatting logic and input validation (notably in PRs #30578 and #30350) may have made the backend less tolerant of missing or malformed fields, or changed how the frontend retrieves the engine value reference. If the frontend is sending an undefined or invalid
engine, or if thesqlfield is empty or missing, the backend will return a 400 error.To troubleshoot, check the network request payload in your browser's dev tools and confirm both
sqlandengineare present and valid. Ifengineis undefined or the SQL is empty, that's likely the cause. This regression is likely due to stricter validation or a frontend change in how the engine is fetched from the dataset metadata.To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

saghatelian commentedon Oct 16, 2025
Following the steps suggested by @dosu , here are the details of the request:
Request URL:
/api/v1/sqllab/format_sql/Payload:
Response:
Seems like the error is because the engine is a JSON object
{"backend":"bigquery"}, not a string.dosubot commentedon Oct 16, 2025
The 400 error happens because the backend expects the engine field to be a string (like "bigquery"), not an object. The correct payload should look like:
{ "sql": "SELECT ...", "engine": "bigquery" }This is enforced by the backend schema and confirmed in the frontend code, which should send engine as a string, not as { "backend": "bigquery" } (reference, backend schema). The regression likely comes from a recent frontend change that started passing the whole backend object instead of just the string. Updating the frontend to send only the backend string should resolve the issue.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

fix(explore): send database backend as string in View Query format re…