-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
feat: TreeMap migration #20346
feat: TreeMap migration #20346
Conversation
"""adding_advanced_data_type.py | ||
"""adding advanced data type to column models | ||
|
||
Revision ID: 6f139c533bea | ||
Revises: cbe71abde154 | ||
Create Date: 2021-05-27 16:10:59.567684 | ||
|
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.
Codecov Report
@@ Coverage Diff @@
## master #20346 +/- ##
==========================================
- Coverage 66.71% 66.68% -0.04%
==========================================
Files 1752 1753 +1
Lines 65478 65710 +232
Branches 6916 6940 +24
==========================================
+ Hits 43681 43816 +135
- Misses 20049 20132 +83
- Partials 1748 1762 +14
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite://" | ||
app.config["SQLALCHEMY_DATABASE_URI"] = ( | ||
os.environ.get("SUPERSET__SQLALCHEMY_DATABASE_URI") or "sqlite://" | ||
) |
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.
Use integration test database instance for local debugging.
7b4e0dc
to
9e44fa0
Compare
treemap_processor = get_migrate_class[MigrateVizEnum.treemap] | ||
|
||
|
||
def test_treemap_migrate(app_context: SupersetApp) -> None: |
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.
Maybe have separated tests for upgrade and downgrade?
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.
the method of downgrade needs an updated slice so combine upgrade and downgrade in the same unit test case.
return slc | ||
|
||
|
||
class MigrateTreeMap(MigrateViz): |
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.
Maybe move MigrateTreeMap
to its own file? I guess we'll have a bunch of these.
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.
This is a one-time script. There is no need to split moudles.
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.
Won't we have other viz types to be migrated? If yes, are you going to add all the viz types to this file?
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.
yep, all migrations are placed in this script.
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.
Generally, scripts are waterfalls, while libary should be modular.
if key in self.mapping_keys and self.mapping_keys[key] in rv_data: | ||
raise ValueError("Duplicate key in target viz") | ||
|
||
if key in self.mapping_keys: | ||
rv_data[self.mapping_keys[key]] = value |
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.
I personally find this more readable, but it's not a blocker.
if key in self.mapping_keys and self.mapping_keys[key] in rv_data: | |
raise ValueError("Duplicate key in target viz") | |
if key in self.mapping_keys: | |
rv_data[self.mapping_keys[key]] = value | |
if key in self.mapping_keys: | |
mapped_key = self.mapping_keys[key] | |
if mapped_key in rv_data: | |
raise ValueError("Duplicate key in target viz") | |
rv_data[mapped_key] = value |
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.
Exception handling is easier to maintain if it can be put together.
b2daecf
to
0d10fb3
Compare
@zhaoyongjie @rusackas Shouldn't we disable TreeMap v1 after the migration? By that, I mean no more TreeMap v1 on Add Slice and Chart Type filter in the charts list. Right now, the user can still create the old version which kind of defeats the whole purpose of the migration. |
I intend to do a separated PR that removes the Legacy TreeMap after merged migration PR. the follow-up PR will 1) remove Legacy TreeMap from plugins, 2) remove legacy TreeMap from MainPresent.js. |
May I suggest implementing this in the same PR to avoid the risk of someone executing the script and creating an old TreeMap before the follow-up PR is merged? |
superset/migrations/versions/2022-06-30_22-04_c747c78868b6_migrating_legacy_treemap.py
Outdated
Show resolved
Hide resolved
@john-bodley thanks for the reviewing, I have addressed comments. |
SUMMARY
This PR intends to introduce an approach that migrates from v1 viz to v2 viz. The first PR implement TreeMap migration.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION