Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(embedded): sankey charts #30491

Merged
merged 1 commit into from
Oct 2, 2024
Merged

fix(embedded): sankey charts #30491

merged 1 commit into from
Oct 2, 2024

Conversation

betodealmeida
Copy link
Member

@betodealmeida betodealmeida commented Oct 1, 2024

SUMMARY

A saved Sankey chart query context has the source and target columns in the groupby field:

{
    "queries": [
        {
            ...
            "columns": [],
            "metrics": ["count"],
            "groupby": ["bot_id", "channel_id"],  # here
         },
    ],
}

But the query context from the same chart, when embedded, looks like this:

{
    "queries": [
        {
            ...
            "columns": ["bot_id", "channel_id"],
            "metrics": ["count"],
            # no "groupby" key
         },
    ],
}

This PR modifies the query_context_modified function to account for this case.

Note that this approach is a short term solution to unblock 4.1. I think two better (but more complext) solutions would be:

  1. Make sure the query object from an unmodified chart in a dashboard always matches the stored query object.
  2. Even better: dashboards should send the chart ID and any native filters, instead of sending the whole payload for the chart. This would prevent maliciously modifying requests over the wire.

Fixes #30205

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@betodealmeida betodealmeida marked this pull request as ready for review October 1, 2024 14:14
@dosubot dosubot bot added embedded viz:charts:sankey Related to the Sankey chart labels Oct 1, 2024
@sadpandajoe sadpandajoe added the v4.1 Label added by the release manager to track PRs to be included in the 4.1 branch label Oct 1, 2024
@rusackas
Copy link
Member

rusackas commented Oct 1, 2024

Yaaaaay! It's almost 4.1 go-time! 🚀

@betodealmeida betodealmeida merged commit e0172a2 into master Oct 2, 2024
36 checks passed
sadpandajoe pushed a commit that referenced this pull request Oct 2, 2024
sadpandajoe pushed a commit that referenced this pull request Oct 2, 2024
@github-actions github-actions bot added 🍒 4.1.0 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset-io size/L v4.1 Label added by the release manager to track PRs to be included in the 4.1 branch viz:charts:sankey Related to the Sankey chart 🍒 4.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Superset 4.1.0RC2 - New Sankey charts cannot be embedded = "Guest user cannot modify chart payload"
4 participants