fix: [migration] fix dashboard json_metadata when native filter is not enabled#15197
fix: [migration] fix dashboard json_metadata when native filter is not enabled#15197graceguo-supercat wants to merge 4552 commits into
Conversation
apache#14551) * Fix column name alignment * Fix space wrap
* Fix menu * Fix test
Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2. - [Release notes](https://github.com/npm/ssri/releases) - [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md) - [Commits](npm/ssri@v6.0.1...v6.0.2) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* fix: Adding a little margin under the warning about changing datasets * feat: moves Alert spacing from a css override to an Alert prop * fix: prop needs to be optional... proptional * fix: moving the typing to a better spot, adding the new prop to storybook. * style: linting
* fix: bring back dashboard perf logger * add test
* fix dashboard side actions * lint being lint
…ache#14579) * send queryid up with setSQL * pass latest query id * update * cleanup
…pache#14420) * feat: new endpoint for validating database parameters * Rebase * Remove broken tests
* fix error message icon * lint
…#14419) * intial commit * fix test and add more icons * fix lint
* feat: add generic type to column payload * feat: add generic type to column payload * xit flaky test
* chore: bumping echarts plugin * feat: Upgrading to new treemap * bump @superset-ui/plugin-chart-echarts 0.17.47 Co-authored-by: Yongjie Zhao <yongjie.zhao@gmail.com> Co-authored-by: Ville Brofeldt <ville.v.brofeldt@gmail.com>
…#14618) * Add getTooltipTitle * Fix tests
Co-authored-by: John Bodley <john.bodley@airbnb.com>
* fix popover * addd tabs default css * fix lint * fix tests * address comments * lint fix * fix test * lint
* perf: memoize db_engine_spec in sqla table classes * remove extended cypress timeouts
…pache#14120) * fix: do not render favorite favStar and filter for anonymous user * fix: prevent anonymous user to trigger the favstar view route * fix: lint over previous commit * fix: linter follow-up
Co-authored-by: John Bodley <john.bodley@airbnb.com>
…apache#15172) * fix(dashboard): Prevent rerendering View Query modal on window resize * Fix lint
* Convert TableElement to typescript * Change type names to better match naming conventions in other files * Fix import order and update tests on TableElement * Remove defaultProps * Destructure the props * Use Rest and Spread syntax to condense props destructuring * Fix TypeScript errors and add comment to explain antd props and types weirdness * Remove comment, add consistency with other files, and use method chaining to make more concise Co-authored-by: Corbin Robb <corbin@Corbins-MacBook-Pro.local>
villebro
left a comment
There was a problem hiding this comment.
Minor perf related suggestion, other than that LGTM!
| bind = op.get_bind() | ||
| session = db.Session(bind=bind) | ||
|
|
||
| dashboards = session.query(Dashboard).all() |
There was a problem hiding this comment.
Here you could restrict the query so that you only get the relevant dashboards. Something like
dashboards = session.query(Dashboard).filter(or_(
Dashboard.json_metadata.like('%"show_native_filters"%'),
Dashboard.json_metadata.like('%"native_filter_configuration"%'),
)).all()| if is_feature_enabled("DASHBOARD_NATIVE_FILTERS"): | ||
| print(f"DASHBOARD_NATIVE_FILTERS feature is enabled. skip.") | ||
| return |
There was a problem hiding this comment.
Having migrations depend on feature flags seems brittle to me. What if I have the feature enabled, run this migration, and later decide to turn the feature off?
There was a problem hiding this comment.
i can not handle this back and forth case. I assume there is very little number of users will do this.
| json_metadata.pop("show_native_filters", None) | ||
| json_metadata.pop("native_filter_configuration", None) |
There was a problem hiding this comment.
Why do we need to remove these attributes?
Can we make Superset ignore these attributes if DASHBOARD_NATIVE_FILTERS is not enabled instead?
There was a problem hiding this comment.
No. when we start to convert dashboard filter_box to filter components, I rely on native_filter_configuration to decide if this dashboard needs to convert, or already converted.
There was a problem hiding this comment.
Sorry, I don't have all the context here and I'm just trying to understand.
Shouldn't we do the conversion of dashboard filter box to filter components only if the feature flag is enabled?
There was a problem hiding this comment.
There are 2 types of users: already used native filters, and user never used native filters. During migration period, i will run some logic in the front-end, to decide if we want to convert filter_box into filter components.
- if dashboard not have
native_filter_configuration: start JS convert, user will review this change, they decide save this convert or not. if there is an issue in the convert, user can report and we need to fix. - if dashboard has
native_filter_configuration: this means feature is enabled, user may have mixed filter_box and filter components. In this case, DO NOT run JS convert.
In short, "JS convert", or later we will have "db migration auto convert", will only apply for dashboards without native_filter_configuration. there is no automatic convert for dashboards with mixed filter_box and filter components. For all of above cases, user needs to manually delete filter_box from their dashboard.
Please see SIP-64 for convert logic.
Codecov Report
@@ Coverage Diff @@
## master #15197 +/- ##
==========================================
- Coverage 77.47% 77.09% -0.39%
==========================================
Files 969 971 +2
Lines 50021 50236 +215
Branches 6432 6494 +62
==========================================
- Hits 38756 38729 -27
- Misses 11060 11302 +242
Partials 205 205
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
5bc8646 to
8c93633
Compare
|
I agree with @betodealmeida that conditional migrations based on feature flags may lead to unintended results. If the |
8c93633 to
e94a812
Compare
Please see my reply to Beto. It will impact the decision after we start migrating filter_box to filter component. |
|
The concerns that have been raised are valid in the sense that if someone who has been using NF for a long time happens to turn off the FF during the migration, it might end up wiping out the existing filter configurations. To mitigate this and remove the dependency on the feature flag, I propose the following: If, and only if, the following properties are set to the following: the properties are removed. Otherwise we don't touch them. This won't have any effect on dashboards for envs that have the native filters feature flag enabled, nor will it impact envs that have it disabled. |
|
@betodealmeida @robdiciuccio Do you feel more comfortable with @villebro's suggestion? Airbnb team also consider running this PR in airbnb's release branch, so that we won't impact any open source users. But if any corporation happened to have a deployment before #15146, they probably can't have auto convert filter_box to filter components. I assume this case is very small. |
|
i discussed this solution with @villebro, i decided to keep this change inside airbnb. for open source users, if they happened to have a deployment during bad time, they can contact us to get a solution. |
SUMMARY
This PR will scan all dashboard json_metada: if
DASHBOARD_NATIVE_FILTERSfeature is not enabled, removeshow_native_filtersandnative_filter_configurationproperties from json_metadata.See #14933 (comment) for more context.
TESTING INSTRUCTIONS
CI and manual test.
ADDITIONAL INFORMATION