aminghadersohi commented on code in PR #38977:
URL: https://github.com/apache/superset/pull/38977#discussion_r3016202754
##########
superset/mcp_service/chart/tool/get_chart_data.py:
##########
@@ -369,6 +369,38 @@ async def get_chart_data( # noqa: C901
# Bubble charts use x/y/size as separate metric fields.
viz_type = chart.viz_type or ""
+ # Deck.gl chart types store spatial data (lat/lon)
+ # rather than traditional metrics/groupby. They
+ # require a saved query_context to retrieve data.
+ deck_gl_types = (
+ "deck_arc",
+ "deck_geojson",
+ "deck_grid",
+ "deck_hex",
+ "deck_multi",
+ "deck_path",
+ "deck_polygon",
+ "deck_scatter",
+ "deck_screengrid",
+ )
+ if viz_type in deck_gl_types:
+ await ctx.warning(
Review Comment:
Good catch — switched to `viz_type.startswith("deck_")` to match all current
and future deck.gl viz types. Fixed in latest push.
##########
superset/mcp_service/chart/tool/get_chart_data.py:
##########
@@ -369,6 +369,38 @@ async def get_chart_data( # noqa: C901
# Bubble charts use x/y/size as separate metric fields.
viz_type = chart.viz_type or ""
+ # Deck.gl chart types store spatial data (lat/lon)
+ # rather than traditional metrics/groupby. They
+ # require a saved query_context to retrieve data.
+ deck_gl_types = (
+ "deck_arc",
+ "deck_geojson",
+ "deck_grid",
+ "deck_hex",
+ "deck_multi",
+ "deck_path",
+ "deck_polygon",
+ "deck_scatter",
+ "deck_screengrid",
+ )
Review Comment:
Fixed — using `viz_type.startswith("deck_")` prefix match now instead of a
hardcoded tuple. This covers deck_heatmap, deck_contour, and any future deck.gl
types.
##########
superset/mcp_service/dataset/schemas.py:
##########
@@ -307,6 +308,13 @@ def _parse_json_field(obj: Any, field_name: str) ->
Dict[str, Any] | None:
return value
+def _humanize_timestamp(dt: datetime | None) -> str | None:
+ """Convert a datetime to a humanized string like '2 hours ago'."""
+ if dt is None:
+ return None
+ return humanize.naturaltime(datetime.now() - dt)
Review Comment:
Fixed — all three `_humanize_timestamp` functions now use
`datetime.now(timezone.utc)`.
##########
superset/mcp_service/chart/schemas.py:
##########
@@ -271,6 +272,13 @@ def validate_identifier_or_form_data_key(self) ->
"GetChartInfoRequest":
return self
+def _humanize_timestamp(dt: datetime | None) -> str | None:
+ """Convert a datetime to a humanized string like '2 hours ago'."""
+ if dt is None:
+ return None
+ return humanize.naturaltime(datetime.now() - dt)
Review Comment:
Fixed — using `datetime.now(timezone.utc)` now. Thanks.
--
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]