Abdulrehman-PIAIC80387 commented on issue #40570:
URL: https://github.com/apache/superset/issues/40570#issuecomment-5475582329

   Traced this on master and agree with @rusackas — the datasource model side 
is fine. `get_sqla_query()` correctly merges `template_params_dict` and invokes 
the template processor for any caller, so the fix does not belong there.
   
   The gap is caller-side. The HTTP chart-data endpoint calls 
`set_form_data(...)` before `ChartDataCommand.run()` to seed `g.form_data` for 
the no-request-context fallback in the Jinja macros (`url_param`, 
`filter_values`, `get_filters`, `current_user_email`). Two MCP tools already do 
the equivalent via `set_query_context_form_data`: 
[`get_chart_data`](https://github.com/apache/superset/blob/master/superset/mcp_service/chart/tool/get_chart_data.py#L676)
 and 
[`query_dataset`](https://github.com/apache/superset/blob/master/superset/mcp_service/dataset/tool/query_dataset.py#L314).
 The chart compile/preview paths — 
[`_compile_chart`](https://github.com/apache/superset/blob/master/superset/mcp_service/chart/compile.py)
 and 
[`generate_preview_from_form_data`](https://github.com/apache/superset/blob/master/superset/mcp_service/chart/preview_utils.py)
 — are the two that missed it.
   
   Opening a PR shortly that mirrors the sibling pattern (one call inside each 
of those two functions, plus regression tests). I don't have a Docker repro 
locally, so the evidence there is the code trace + parity gap rather than a 
runtime stack; happy to add a traceback later if the diff isn't self-evident. 
CC @sadpandajoe @aminghadersohi.


-- 
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]

Reply via email to