-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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: add a command to import charts #11743
Conversation
@classmethod | ||
def _parent_foreign_key_mappings(cls) -> Dict[str, str]: | ||
"""Get a mapping of foreign name to the local name of foreign keys""" | ||
parent_rel = cls.__mapper__.relationships.get(cls.export_parent) | ||
if parent_rel: | ||
return {l.name: r.name for (l, r) in parent_rel.local_remote_pairs} | ||
return {} | ||
|
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 not being used anywhere, seems like the result of a bad merge because we have an identical class method called parent_foreign_key_mappings
(no leading underscore).
@@ -171,7 +163,7 @@ def import_from_dict( | |||
|
|||
# Remove fields that should not get imported | |||
for k in list(dict_rep): | |||
if k not in export_fields: | |||
if k not in export_fields and k not in parent_refs: |
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 necessary to preserve the parent ID in the config when importing, otherwise it gets deleted.
@@ -343,3 +345,32 @@ def test_import_v1_dataset_validation(self): | |||
"database_name": ["Missing data for required field."], | |||
} | |||
} | |||
|
|||
def test_import_v1_dataset_existing_database(self): |
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 unit test is unrelated, but I thought about this case and decided to add it in this PR.
Codecov Report
@@ Coverage Diff @@
## master #11743 +/- ##
==========================================
+ Coverage 66.61% 67.20% +0.58%
==========================================
Files 897 899 +2
Lines 43463 43560 +97
Branches 4015 4015
==========================================
+ Hits 28955 29276 +321
+ Misses 14391 14180 -211
+ Partials 117 104 -13
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
b7bb575
to
7998a5e
Compare
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.
👍
SUMMARY
This PR adds a new command
ImportChartsCommand
to import a new bundle with exported charts (#11167).BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TEST PLAN
Added unit tests for imports and validation.
ADDITIONAL INFORMATION