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

chore: Add a migration that removes filter_bar_orientation from dashboard's json_metadata #22248

Merged

Conversation

kgabryje
Copy link
Member

@kgabryje kgabryje commented Nov 28, 2022

SUMMARY

This PR adds a downgrade migration that removes filter_bar_orientation field from dashboard's json_metadata.
It's related to the horizontal filter bar feature that's currently in development and is locked behind a HORIZONTAL_FILTER_BAR feature flag.
It's a required cleanup step when downgrading Superset version, because the horizontal filter bar project adds filter_bar_orientation field to DashboardJSONMetadataSchema schema.
Upgrade is not required - we simply default to VERTICAL if filter_bar_orientation is not present

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
      Current: 0.26 s 10+: 0.40 s 100+: 0.41 s 1000+: 0.25 s
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Nov 28, 2022

Codecov Report

Merging #22248 (0f03a15) into master (435926b) will increase coverage by 10.01%.
The diff coverage is n/a.

❗ Current head 0f03a15 differs from pull request most recent head d99ad27. Consider uploading reports for the commit d99ad27 to get more accurate results

@@             Coverage Diff             @@
##           master   #22248       +/-   ##
===========================================
+ Coverage   55.46%   65.48%   +10.01%     
===========================================
  Files        1841     1841               
  Lines       70220    70220               
  Branches     7670     7670               
===========================================
+ Hits        38947    45981     +7034     
+ Misses      29291    22257     -7034     
  Partials     1982     1982               
Flag Coverage Δ
hive 52.56% <ø> (?)
mysql 78.07% <ø> (?)
postgres 78.14% <ø> (?)
presto ?
python 78.48% <ø> (+21.03%) ⬆️
sqlite 76.59% <ø> (?)
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...set/advanced_data_type/plugins/internet_address.py 16.32% <0.00%> (-79.60%) ⬇️
superset/utils/pandas_postprocessing/boxplot.py 20.51% <0.00%> (-79.49%) ⬇️
superset/charts/post_processing.py 11.76% <0.00%> (-77.95%) ⬇️
...perset/advanced_data_type/plugins/internet_port.py 18.75% <0.00%> (-77.09%) ⬇️
superset/utils/pandas_postprocessing/rolling.py 21.87% <0.00%> (-68.75%) ⬇️
...perset/utils/pandas_postprocessing/contribution.py 34.61% <0.00%> (-65.39%) ⬇️
superset/utils/pandas_postprocessing/resample.py 37.50% <0.00%> (-62.50%) ⬇️
superset/utils/pandas_postprocessing/select.py 38.46% <0.00%> (-61.54%) ⬇️
superset/utils/pandas_postprocessing/rename.py 40.00% <0.00%> (-60.00%) ⬇️
superset/utils/pandas_postprocessing/compare.py 32.25% <0.00%> (-58.07%) ⬇️
... and 318 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'm still on the fence about maybe placing

class Meta:
    unknown = EXCLUDE

on all these schemas that are known to evolve over time to avoid getting 400s when upgrading/downgrading and having old leftover cruft on the metadata. But maybe leave that for a follow-up discussion.

Comment on lines 62 to 63
json_meta.pop("filter_bar_orientation", None)
dashboard.json_metadata = json.dumps(json_meta)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: To avoid unnecessarily updating the metadata if someone happens to have the text filter_bar_orientation in one of the titles, descriptions or similar (highly likely 😄), maybe add this as a precaution:

Suggested change
json_meta.pop("filter_bar_orientation", None)
dashboard.json_metadata = json.dumps(json_meta)
filter_bar_orientation = json_meta.pop("filter_bar_orientation", None)
if filter_bar_orientation:
dashboard.json_metadata = json.dumps(json_meta)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, didn't think of that 😄

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reapproving most recent changes

@kgabryje kgabryje merged commit 79e7980 into apache:master Nov 29, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 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 size/M 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants