aminghadersohi opened a new pull request, #43478:
URL: https://github.com/apache/superset/pull/43478

   Recreates #43338, which GitHub auto-closed when its head fork was deleted. 
Same commits, no content changes.
   
   ---
   
   ### SUMMARY
   `get_chart_sql`'s request schema had no `extra_form_data` field. Pydantic 
silently
   drops unrecognized fields by default, so any filters passed alongside a chart
   identifier were dropped before validation ever ran — the tool always 
rendered the
   chart's unfiltered baseline SQL regardless of what was passed in.
   
   `get_chart_data` already merges `extra_form_data` correctly via
   `merge_extra_form_data_filters_into_query` / 
`build_query_context_from_form_data`
   (added in a prior fix). This PR adds the same `extra_form_data` field to
   `GetChartSqlRequest` and wires it into both of `get_chart_sql`'s 
SQL-construction
   paths (saved `query_context`, and the `form_data` fallback), reusing the 
existing
   merge helpers instead of adding new filter-merging logic.
   
   `get_chart_data` already applied filters correctly. The shared helper update 
in this
   PR additionally preserves normalized relative-time extras (`relative_start` 
and
   `relative_end`) for both chart-data and chart-SQL query construction.
   
   ### TESTING INSTRUCTIONS
   - New unit tests in 
`tests/unit_tests/mcp_service/chart/tool/test_get_chart_sql.py`:
     - `GetChartSqlRequest` accepts and stores `extra_form_data` (previously 
silently
       dropped).
     - `_build_query_context_from_form_data` forwards `extra_form_data` to the 
query
       factory.
     - `_sql_from_saved_query_context` merges `extra_form_data` into the query 
handed
       to `ChartDataQueryContextSchema.load` before rendering SQL.
     - End-to-end: `request.extra_form_data` reaches the saved-query_context SQL
       builder and shows up in the rendered SQL.
   - New unit tests in 
`tests/unit_tests/mcp_service/chart/tool/test_get_chart_data.py`
     cover the (already-correct, previously untested) `get_chart_data` path 
where a
     chart identifier + `extra_form_data` are both provided — both the 
`filters` and
     `adhoc_filters` extra_form_data formats, plus a `TEMPORAL_RANGE` filter.
   - `pytest tests/unit_tests/mcp_service/` — full suite passes.
   - `pre-commit run` on all changed files — clean.
   
   ### 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
   
   


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