-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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: Allow chart import to update the dataset an existing chart points to #24821
fix: Allow chart import to update the dataset an existing chart points to #24821
Conversation
Codecov Report
@@ Coverage Diff @@
## master #24821 +/- ##
=======================================
Coverage 68.98% 68.98%
=======================================
Files 1903 1903
Lines 74007 74008 +1
Branches 8193 8193
=======================================
+ Hits 51052 51053 +1
Misses 20834 20834
Partials 2121 2121
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
This is awesome! Thanks!!! |
The SIP not only proposes the UI to allow choice in the cascade of overrides, but also having a checkbox or similar introduces a place to check for or add ownership/RBAC constraints. I'll add this comment (and others) to the sip as well. |
I don't believe this PR is in conflict with that SIP, or that this functionality is relevant to that SIP. This isn't doing any cascading updates to child objects, it simply allows pointing a chart at a different dataset than it currently does. Also note that there is already an explicit confirmation that has to be performed when overwriting an asset via import |
I think this would only conflict with the SIP in case the chart dataset update also happens when importing a dashboard. Currently the overwrite check is only "applied" to the actual asset being imported -- for example, if you import a dashboard with charts, the dashboard will be overwritten but charts wouldn't. So if this change is only applied when importing a chart directly (or via the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@michael-s-molina this is not directly related to the SIP you mentioned; it's not doing any cascade imports but just point the chart to a different dataset (which could be new or existing).
Got it. Thanks @jfrag1 @Vitor-Avila and @betodealmeida for the additional context. |
@jfrag1 finally someone who understands the issue and know how to fix it! You are the best! Can't wait for it... |
SUMMARY
Currently, attempting to overwrite a chart via import fails when the chart in the import file points to a dataset other than the one the chart currently points at.
This is because of the following filter which gets added to the query that checks if the chart being imported already exists:
which for charts evalulates to
When the chart's dataset has been changed, the query fails to find the chart even if a chart with the same UUID exists. It then attempts to create the chart since it thinks it doesn't exist, which obviously fails the UUID uniqueness constraint.
This PR allows for charts to be "re-parented" to another dataset on import by removing this filter for chart imports, which can be useful when importing and exporting assets between environments after making changes, or for managing assets as code.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
SELECT * FROM <physical_dataset>
)dataset_uuid
values for the chartsADDITIONAL INFORMATION