Wanted to resurrect this thread. I followed #1 and wrote some python that can load datasources from a yaml file looking like this:
databases:
- database_name: TestDB
verbose_name: "Test DB"
sqlalchemy_uri: "sqlite:////home/test/.superset/superset.db"
password: null
cache_timeout: 1000
expose_in_sqllab: true
tables:
- schema: null
table_name: 'user'
columns:
- column_name: 'id'
verbose_name: 'User Id'
is_active: true
type: BIGINT
groupby: true
count_distinct: true
sum: true
filterable: true
- column_name: 'name'
verbose_name: 'User Name'
is_active: true
type: VARCHAR
metrics:
- metric_name: count
verbose_name: count
metric_type: count
expression: "COUNT(*)"
Its pretty straight forward and makes use of the models in superset.connectors.sqla.models and the `export_fields` field on those models. Currently I have it as a standalone script but I think it would be helpful to include this right into superset.
I'm imagining something like adding it to the superset cli: superset add_datasources <yaml file>
Another option is to add an "Import Datasource" page in the "Manage" tab of the Web UI that allows us to load datasources through the web app. Obviously cli and web are not exclusive.
I could probably add YAML functionality to the dashboard import/export as well (in 2nd step), in addition to the existing pickle import/export. Benefits of YAML are
1. can edit in editor
2. store in source control
3. more human readable than json (comments, etc)
4. can easily be generated from another language
Any thoughts?
If you are interested in the feature, I would implement the cli feature first and go from there.
Fabian