-
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
fix: API to allow importing old exports (JSON/YAML) #13444
Conversation
Codecov Report
@@ Coverage Diff @@
## master #13444 +/- ##
==========================================
- Coverage 77.45% 71.49% -5.97%
==========================================
Files 903 804 -99
Lines 45640 40616 -5024
Branches 5500 4157 -1343
==========================================
- Hits 35349 29037 -6312
- Misses 10165 11579 +1414
+ Partials 126 0 -126
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
Looks good, left a comment
def __init__(self, contents: Dict[str, str], database_id: Optional[int] = None): | ||
# pylint: disable=unused-argument | ||
def __init__( | ||
self, contents: Dict[str, str], database_id: Optional[int] = None, **kwargs: Any |
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.
is contents a flat Dict
? also why the kwargs
here, they receive passwords
and overwrite
but nothing is done with them, I'm probably missing something.
It would be nice also to add a description for the fields on the API spec:
schema:
type: object
properties:
formData:
type: string
format: binary
passwords:
type: string
overwrite:
type: bool
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.
contents
is a flat dict, with filename => file_contents
.
*kwargs
is needed because different version (v0
vs v1
) take different arguments, so they just discard what they don't need.
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'll add the description to the API, I thought I had added it.
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.
@dpgaspar, the spec is up-to-date in api.py
: https://github.com/apache/superset/pull/13444/files#diff-f6a877e9c3a368e3c41256960e6bddff588b7d26f5ad750d5378f2fd65722508R761-R767
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 mean a description for the passwords
, overwrite
, formData
fields
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.
Ah, a description! Will do! :)
* fix: fix API to allow importing old exports (JSON/YAML) * Fix test * Fix lint * Add description to API schema
SUMMARY
The new APIs for importing dashboards and datasets only accept ZIP files, even though the logic to import the old format (JSON and YAML, respectively) is in the backend. This PR makes the API accept the old format.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TEST PLAN
Added tests, and also tested manually.
ADDITIONAL INFORMATION