LuisSanchez commented on code in PR #36277:
URL: https://github.com/apache/superset/pull/36277#discussion_r2565583891
##########
superset-frontend/src/SqlLab/actions/sqlLab.js:
##########
@@ -914,11 +914,26 @@ export function
queryEditorSetAndSaveSql(targetQueryEditor, sql, queryId) {
export function formatQuery(queryEditor) {
return function (dispatch, getState) {
- const { sql } = getUpToDateQuery(getState(), queryEditor);
+ const qe = getUpToDateQuery(getState(), queryEditor);
+ const { sql, dbId, templateParams } = qe;
+ const body = { sql };
+
+ // Include database_id and template_params if available for Jinja
processing
+ if (dbId) {
+ body.database_id = dbId;
+ }
+ if (templateParams) {
+ // Send templateParams as a JSON string to match the backend schema
+ body.template_params =
+ typeof templateParams === 'string'
+ ? templateParams
+ : JSON.stringify(templateParams);
+ }
+
return SupersetClient.post({
endpoint: `/api/v1/sqllab/format_sql/`,
// TODO (betodealmeida): pass engine as a parameter for better formatting
Review Comment:
Forgot to remove it, we are solving it, done.
--
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]