Files
superset2/tests/integration_tests
Evan RusackasandClaude Sonnet 5 f7503213e2 fix(charts): reject non-table datasource_type instead of crashing
Slice.datasource only ever resolves the "table" relationship, so a
chart created (or repointed via update) with datasource_type
"saved_query" or "query" would either crash outright or "succeed" as
a chart that can never actually render:

- "saved_query": SavedQuery has no .name attribute, so validate()
  crashes with an unhandled AttributeError -- surfaced to API clients
  as an opaque 500 "Fatal error" (fixes #29697).
- "query": Query has a synthetic .name property (used for CTAS table
  naming, not a real display name), so this one doesn't crash -- it
  silently creates a permanently broken chart instead.

CreateChartCommand and UpdateChartCommand now reject both up front
with the existing DatasourceTypeInvalidError (422), matching the
pattern already used for this same class of problem in
explore/utils.py and dataset/duplicate.py, rather than adding a new
one-off error type.

Adds unit tests for both commands (TDD: written first against
unfixed code to confirm they reproduce the two distinct failure
modes above, then the fix, then confirmed green) and an integration
test reproducing the original bug report's exact API call shape.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-24 21:41:33 -07:00
..