betodealmeida opened a new pull request #11884:
URL: https://github.com/apache/incubator-superset/pull/11884


   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   
   This PR adds a new button to import databases from the UI if the 
`VERSIONED_EXPORT` feature flag is enabled. It allows users to import databases 
in the new format proposed in 
https://github.com/apache/incubator-superset/issues/11167.
   
   The biggest challenge in importing databases is that we export them without 
passwords, extra security information, nor certificates. When importing 
databases we can inspect the `sqlalchemy_uri` and see if it has a masked 
password, and if true we can prompt the user for the password.
   
   The second biggest challenge is that we don't know how many databases are 
present in the imported file, since users can export multiple databases at once 
in a single file. We also don't know how many of those require passwords, since 
not all databases use them.
   
   To work around this when the user tries to import a file the frontend will 
upload it to the backend. The backend performs validation on the file, and if 
there are databases with masked passwords it returns a validation error (422). 
The frontend will parse the error message, and if the only errors are from 
missing passwords it will prompt the user for the passwords and resubmit the 
file, this time with the associated passwords.
   
   This PR adds the backend validation, as well as the import modal. For the 
API calls I added a new method to `useSingleViewResource` called 
`importResource`, which will be reused for other imports (dataset, chart, 
dashboard and saved queries).
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   Will add.
   
   ### TEST PLAN
   <!--- What steps should be taken to verify the changes -->
   
   Manually tested importing a database, and confirmed it prompts for the 
password and the database is configured correctly.
   
   Also added tests.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [X] Has associated issue: 
https://github.com/apache/incubator-superset/issues/11167
   - [ ] Changes UI
   - [ ] Requires DB Migration.
   - [ ] Confirm DB Migration upgrade and downgrade tested.
   - [X] Introduces new feature or API
   - [ ] Removes existing feature or API
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to