rebenitez1802 commented on code in PR #44681:
URL: https://github.com/apache/superset/pull/44681#discussion_r4160928234


##########
superset/mcp_service/dashboard/schemas.py:
##########
@@ -417,7 +421,16 @@ class DashboardChartSummary(BaseModel):
     id: int | None = Field(None, description="Chart ID")
     slice_name: str | None = Field(None, description="Chart name")
     viz_type: str | None = Field(None, description="Visualization type")
-    datasource_name: str | None = Field(None, description="Datasource name")
+    datasource_id: int | None = Field(

Review Comment:
   🟡 Medium — `datasource_id` without `datasource_type`
   
   `DashboardChartSummary` now has `datasource_id` but no `datasource_type`, 
and a datasource id is only unique within its type. The fixture in this PR 
gives a table and a semantic view the same id 1, so `get_dashboard_info` (and 
generate/add/remove/duplicate dashboard) can return two charts with 
`datasource_id: 1` that can't be told apart. A saved_query chart reports a 
SavedQuery id. Matching by name doesn't work either: `get_dashboard_datasets` 
names tables by bare `table_name`, while these summaries use 
`schema.table_name`.
   
   Fix: add the type next to the id, behind the same gate (`datasource_type` is 
already in `CHART_DATA_MODEL_COLUMNS`):
   
   ```python
   datasource_type: str | None = Field(
       None,
       description="Type of the datasource; datasource_id is only unique within 
this type",
   )
   ```
   
   and in `serialize_chart_summary`:
   
   ```python
   datasource_type=getattr(chart, "datasource_type", None)
   if include_data_model_metadata
   else None,
   ```
   



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