aminghadersohi opened a new pull request, #44950:
URL: https://github.com/apache/superset/pull/44950
## TL;DR
- Find charts by dataset ID instead of relying on non-unique dataset names.
- Support equality and membership filters, with matching schema discovery
and unchanged access filtering.
### SUMMARY
Dataset IDs are already present on charts, but the MCP chart filter schema
rejects `datasource_id`. This adds the column to `list_charts`, limits it to
`eq`, `ne`, `in`, and `nin`, and advertises those operators through
`get_schema`.
Equality operators require one integer; membership operators require a list
of integers. Documentation and filter descriptions explain how to find charts
on a dataset. Queries continue through the existing chart DAO and
metadata-permission gate; no authorization or pagination behavior is changed.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable: no UI changes. Before, dataset ID filters were rejected;
after, `{"col": "datasource_id", "opr": "eq", "value": 42}` selects charts
querying dataset 42.
### TESTING INSTRUCTIONS
1. Call `get_schema` with `{"request": {"model_type": "chart"}}` and confirm
`datasource_id` advertises `eq`, `ne`, `in`, and `nin`.
2. Call `list_charts` with `{"request": {"filters": [{"col":
"datasource_id", "opr": "eq", "value": 42}], "select_columns": ["id",
"datasource_id"]}}`, substituting an accessible dataset ID.
3. Check `ne` with an integer and `in`/`nin` with integer lists. Text and
range operators should fail validation.
4. Run `pytest tests/unit_tests/mcp_service/chart/tool/test_list_charts.py
tests/unit_tests/mcp_service/chart/tool/test_list_charts_deleted_state.py
tests/unit_tests/mcp_service/system/tool/test_get_schema.py
tests/unit_tests/mcp_service/chart/test_chart_schemas.py`.
Local results: 196 tests passed; staged-file pre-commit and explicit mypy
checks passed.
## Eval evidence
All 26 added regression cases failed before the fix. After the fix, the
196-test targeted suite passes, covering actual SQL predicates for all four
operators, value/operator rejection, discovery, and the existing metadata
privacy gate. End-to-end conversational evaluations have not been run.
## Cost & latency delta
Not measured. No external calls or new datasource lookups are added; the
filter uses the existing chart-list SQL query.
## Risk & rollback
Additive filter support; existing filter columns are unchanged. No database
migration. Reverting this change removes the new filter option.
### 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
- [x] Introduces new 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]