mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
feat(mcp): add datasource field to generate_explore_link form_data (#36543)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -94,6 +94,11 @@ async def generate_explore_link(
|
||||
# Map config to form_data using shared utilities
|
||||
form_data = map_config_to_form_data(request.config)
|
||||
|
||||
# Add datasource to form_data for consistency with generate_chart
|
||||
# Only set if not already present to avoid overwriting
|
||||
if "datasource" not in form_data:
|
||||
form_data["datasource"] = f"{request.dataset_id}__table"
|
||||
|
||||
await ctx.debug(
|
||||
"Form data generated with keys: %s, has_viz_type=%s, has_datasource=%s"
|
||||
% (
|
||||
|
||||
@@ -683,3 +683,5 @@ class TestGenerateExploreLink:
|
||||
assert isinstance(result.data["form_data"], dict)
|
||||
assert result.data["form_data"].get("viz_type") == "echarts_timeseries_line"
|
||||
assert result.data["form_data"].get("x_axis") == "date"
|
||||
# Verify datasource field format: "{dataset_id}__table"
|
||||
assert result.data["form_data"].get("datasource") == "1__table"
|
||||
|
||||
Reference in New Issue
Block a user