Databases export/import yaml file bug
Superset bug in exporting datasources from the web application, the errors it produces while importing and a simple workaround to whoever needs it.
Exporting the databases list from http://localhost:8088/databaseview/list/ will result in a missing leading key of the databases in the .yaml file.
To reproduce error
- Go to http://localhost:8088/databaseview/list/
The exported .yaml file from selecting all databases from the list will look like this
- database_name: main
sqlalchemy_uri: postgresql://superset:XXXXXXXXXX@postgres:5432/superset
tables: []
- database_name: examples
sqlalchemy_uri: postgresql://superset:XXXXXXXXXX@postgres:5432/superset
tables: []
- Import datasources to superset (from the docker container or your environment)
superset import_datasources -p <filename>.yaml
result:
2019-10-25 19:54:52,264:INFO:root:Supplied object is not a dictionary.
Reasons
-
The datasources are not imported correctly
-
The reason is simply because of the leading key in the .yaml file is missing.
-
A bug while generating the .yaml file
Simple fix
- Editing .yaml file manually after exporting from the first picture attached
databases:
- database_name: main
sqlalchemy_uri: postgresql://superset:XXXXXXXXXX@postgres:5432/superset
tables: []
- database_name: examples
sqlalchemy_uri: postgresql://superset:XXXXXXXXXX@postgres:5432/superset
tables: []
- Use the export command from terminal, which generates a correct .yaml file
superset export_datasources -p <filename>.yaml
This exports the .yaml correctly with the leading databases key

Environment
Using docker image in the development mode. superset: 0.34.0 python: 3.6 docker: 19.03.4, build 9013bf5
Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.99. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
I was able to reproduce; @dpgaspar how do you propose we fix this? add the top node databases to the UI export or remove databases from the cli import/export?
I suggest you add the top node databases to the UI export. By doing so, the cli import will work just fine.
Also the cli export already adds the top node databases which works just fine on importing, but it exports all the databases list.
Hi @ibrahimroshdy, @villebro,
I'll submit a PR to fix this
Hi @ibrahimroshdy this is fixed on master now.