Files
superset2/tests
Mehmet Salih Yavuz b9faefb558 fix(mcp): eager-load dataset.metrics to prevent Excel export DetachedInstanceError
get_chart_data with format=excel could fail with
"Parent instance SqlaTable is not bound to a Session; lazy load operation
of attribute metrics cannot proceed" when the dataset's metrics relationship
was accessed after the request-scoped session detached. Pass a
subqueryload(Slice.table -> SqlaTable.metrics) query option on ChartDAO
lookup so metrics are materialized up front and later detachment is harmless.

Mirrors the eager-loading pattern from #39206.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 12:41:47 +03:00
..