aminghadersohi opened a new pull request, #37865:
URL: https://github.com/apache/superset/pull/37865
### SUMMARY
Fixes `TypeError: encoding without a string argument` when the
`list_datasets` MCP tool is called with `database_name` filters.
`database_name` was not in the `DatasetFilter.col` allowed Literal values,
causing a Pydantic `ValidationError` when users try to filter datasets by
database name. This is a reasonable filter since `database_name` appears in the
response.
### BEFORE/AFTER SCREENSHOTS OR COVERAGE REPORT
N/A - backend only change
### TESTING INSTRUCTIONS
1. Call `list_datasets` MCP tool with filter: `{"filters": [{"col":
"database_name", "opr": "ilike", "value": "%example%"}]}`
2. Should return matching datasets instead of TypeError
### ADDITIONAL INFORMATION
**Changes:**
- `superset/mcp_service/dataset/schemas.py` — Add `database_name` to
`DatasetFilter.col` Literal
- `superset/daos/dataset.py` — Override `apply_column_operators` in
`DatasetDAO` to intercept `database_name` filters and join to `Database` table;
update `DATASET_CUSTOM_FIELDS` so `get_dataset_available_filters` reports it
- `tests/unit_tests/mcp_service/dataset/tool/test_dataset_tools.py` — Add
regression tests
**Root cause:** `database_name` lives on the `Database` model, not
`SqlaTable`. The DAO override joins to the Database table and applies the
filter on `Database.database_name`.
--
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]