Skip to content

[cli] Fix, import datasources exported by UI#8477

Merged
dpgaspar merged 5 commits intoapache:masterfrom
preset-io:fix/databaseview-export
Nov 10, 2019
Merged

[cli] Fix, import datasources exported by UI#8477
dpgaspar merged 5 commits intoapache:masterfrom
preset-io:fix/databaseview-export

Conversation

@dpgaspar
Copy link
Member

@dpgaspar dpgaspar commented Oct 30, 2019

CATEGORY

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

Databases/Datasources export on the UI can't be imported by superset import_datasource cli.
This fix makes UI yaml export for SQLAlchemy datasources and Druid compatible with the cli.

ADDITIONAL INFORMATION

REVIEWERS

@villebro

@codecov-io
Copy link

codecov-io commented Oct 30, 2019

Codecov Report

Merging #8477 into master will increase coverage by 0.27%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8477      +/-   ##
==========================================
+ Coverage   66.52%   66.79%   +0.27%     
==========================================
  Files         449      449              
  Lines       22595    22701     +106     
  Branches     2367     2366       -1     
==========================================
+ Hits        15032    15164     +132     
+ Misses       7425     7399      -26     
  Partials      138      138
Impacted Files Coverage Δ
superset/connectors/druid/views.py 69.33% <ø> (+0.41%) ⬆️
superset/utils/import_datasource.py 100% <ø> (ø) ⬆️
superset/views/base.py 72.54% <100%> (+1.9%) ⬆️
superset/views/database/views.py 92.23% <100%> (+8.71%) ⬆️
.../explore/components/controls/DatasourceControl.jsx 67.74% <0%> (-1.01%) ⬇️
superset/db_engine_specs/base.py 80.33% <0%> (-0.4%) ⬇️
.../explore/components/controls/DateFilterControl.jsx 39.62% <0%> (-0.38%) ⬇️
.../assets/src/SqlLab/components/TabbedSqlEditors.jsx 83.03% <0%> (-0.3%) ⬇️
superset/views/core.py 71.96% <0%> (-0.19%) ⬇️
superset/connectors/sqla/models.py 84.81% <0%> (-0.12%) ⬇️
... and 20 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0a3b121...69cd2d2. Read the comment docs.

@villebro
Copy link
Member

I think this should be fixed in the UI export, as currently the UI and CLI are generating different yamls.

@dpgaspar
Copy link
Member Author

dpgaspar commented Oct 30, 2019

I think this should be fixed in the UI export, as currently the UI and CLI are generating different yamls.

Right, but YamlExportMixin is used in a bunch of ModelView's. So some options:

  • We go with this solution
  • Implement a new mixin something like YamlExportDatabaseMixin
  • implement the export right on the DatabaseModelView

It's also a decision between: all UI yaml, export the same data structure or database yaml export and cli export/import use same data structure

@villebro
Copy link
Member

I'm ok with this as a temporary solution if others are ok with it. Perhaps add the infamous TODO: to make sure it gets promptly fixed once someone finds the time? 😄

@dpgaspar dpgaspar changed the title [cli] Fix, import datasources exported by UI [WiP] [cli] Fix, import datasources exported by UI Nov 4, 2019
Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit, other than that LGTM

class YamlExportMixin(object):
yaml_dict_key: Optional[str] = None
"""
Override this if you a dict response instead, with a certain key.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ..if you want a dict response..

@dpgaspar dpgaspar changed the title [WiP] [cli] Fix, import datasources exported by UI [cli] Fix, import datasources exported by UI Nov 10, 2019
@dpgaspar dpgaspar merged commit 650c848 into apache:master Nov 10, 2019
@dpgaspar dpgaspar deleted the fix/databaseview-export branch November 10, 2019 16:29
graceguo-supercat pushed a commit that referenced this pull request Nov 13, 2019
* [cli] Fix, import datasources exported by UI
dpgaspar added a commit that referenced this pull request Nov 15, 2019
* [cli] Fix, import datasources exported by UI
@mistercrunch mistercrunch added 🍒 0.35.1 Cherry-picked to 0.35.1 🍒 0.35.2 Cherry-picked to 0.35.2 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.36.0 First shipped in 0.36.0 labels Feb 28, 2024
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
* [cli] Fix, import datasources exported by UI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M v0.35 🍒 0.35.1 Cherry-picked to 0.35.1 🍒 0.35.2 Cherry-picked to 0.35.2 🚢 0.36.0 First shipped in 0.36.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants