maxcapraro opened a new issue #17049: URL: https://github.com/apache/superset/issues/17049
The import of datasources (e.g. the connection to a PostgreSQL database) fails when using `superset import-datasources`. #### How to reproduce the bug First, I performed an export of a database connection: 1. Spin up a new docker container (from my own image which is basically `superset/latest` + my config file) 1. Log into the application and navigate to `databaseview/list` 1. Create a new database by clicking on `+ DATABASE` (for reproduction, I created a new PostgreSQL connection named `db-for-debugging-import`) 1. Export the database by Clicking the Export-Icon in the database list (resulting in this ZIP file: [database_export_20211009T125106.zip](https://github.com/apache/superset/files/7315592/database_export_20211009T125106.zip)) Subsequently, I attempted to import the file: 1. Unzip the exported datasource, replace the `xxxxxxx...` with the actual password (in this case a throw-away password), make a new zip archive (resulting in this ZIP file: [database_export_20211009T125106.zip](https://github.com/apache/superset/files/7315599/database_export_20211009T125106.zip)) 1. Spin up a new docker container 1. Import the ZIP file by executing `superset import-datasources -p ...` in the container's shell ### Expected results I expected the database to show up under `databaseview/list` and e.g. being able to use it when creating a new dataset (selecting the database, a schema, and a table). ### Actual results When importing via `superset import-datasources -p`, the logs contained the following: ```` superset@kolabri-dashboard-deployment-dd8dd7754-p5sq5:/app$ superset import_datasources -p /kolabri-assets/database_export_20211009T125106.zip Loaded your LOCAL configuration at [/kolabri-assets/superset_config.py] logging was configured successfully 2021-10-09 13:27:15,936:INFO:superset.utils.logging_configurator:logging was configured successfully 2021-10-09 13:27:15,946:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'> /usr/local/lib/python3.8/site-packages/flask_caching/__init__.py:201: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled. warnings.warn( Command failed validation 2021-10-09 13:27:17,396:INFO:superset.datasets.commands.importers.dispatcher:Command failed validation There was an error when importing the dataset(s), please check the exception traceback in the log Traceback (most recent call last): File "/app/superset/cli.py", line 384, in import_datasources ImportDatasetsCommand(contents, overwrite=True).run() File "/app/superset/datasets/commands/importers/dispatcher.py", line 64, in run raise exc File "/app/superset/datasets/commands/importers/dispatcher.py", line 57, in run command.run() File "/app/superset/commands/importers/v1/__init__.py", line 63, in run self.validate() File "/app/superset/commands/importers/v1/__init__.py", line 146, in validate raise exception superset.commands.exceptions.CommandInvalidError: Error importing dataset 2021-10-09 13:27:17,396:ERROR:superset.cli:There was an error when importing the dataset(s), please check the exception traceback in the log Traceback (most recent call last): File "/app/superset/cli.py", line 384, in import_datasources ImportDatasetsCommand(contents, overwrite=True).run() File "/app/superset/datasets/commands/importers/dispatcher.py", line 64, in run raise exc File "/app/superset/datasets/commands/importers/dispatcher.py", line 57, in run command.run() File "/app/superset/commands/importers/v1/__init__.py", line 63, in run self.validate() File "/app/superset/commands/importers/v1/__init__.py", line 146, in validate raise exception superset.commands.exceptions.CommandInvalidError: Error importing dataset ```` #### Screenshots If applicable, add screenshots to help explain your problem. ### Environment (please complete the following information): - browser type and version: `Version 94.0.4606.71 (x86_64)` - superset version: `0.0.0dev` (last pull of the base image was a on October 4th) - python version: `Python 3.8.12` - node.js version: No node.js installed - any feature flags active: - `'VERSIONED_EXPORT' : True` ### Checklist Make sure to follow these steps before submitting your issue - thank you! - [x] I have checked the superset logs for python stacktraces and included it here as text if there are any. - [ ] I have reproduced the issue with at least the latest released version of superset. - [x] I have checked the issue tracker for the same issue and I haven't found one similar. Regarding the second checkbox: I am happy to reproduce this with another "proper" version if this helps, but from [this](https://hub.docker.com/r/apache/superset) I am not 100% sure this is possible yet using the docker images :-) ### Additional context - When importing the ZIP-file via the UI, the import succeeds. Though, an error message appears when trying to edit the database connection: `ERROR: Please re-enter the password`. I am not sure if this is the expected behaviour or part of the issue. - It appears to me (from my outsider's perspective) that this bug is not identical to #16858 and #16848 I am happy to help if any additional info / debugging is useful and thanks in advance for the help :) -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
