Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: new import/export CLI #13921

Merged
merged 3 commits into from
Apr 23, 2021
Merged

Conversation

betodealmeida
Copy link
Member

@betodealmeida betodealmeida commented Apr 1, 2021

SUMMARY

The new CLI for import/export is not working correctly with ZIP files (see #13914). When exporting a dataset or dashboard, the default output file name is dashboard_export_YYYYMMDDTHHMMSS (sic), while it should (1) have the .zip extension and (2) have an actual timestamp instead of the string "YYYYMMDDTHHMMSS".

Import is also broken for the new format, even with the VERSIONED_EXPORT feature flag on it assumes that the input file is the old YAML/JSON format used for datasets and dashboards, respectively. I fixed it by using the same logic as the API, inspecting the file to see if a ZIP file and unbundling it if that's the case.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TEST PLAN

  1. Ran superset export-dashboards
  2. Deleted all charts
  3. Deleted all dashboards
  4. Ran superset import-dashboards -p dashboard_export_20210401T132948.zip
  5. Dashboards were imported correctly

Did the same with datasets (exported datasets; deleted all dashboards, charts, datasets; imported datasets).

Also added unit tests covering import/export with the feature flag on and off.

ADDITIONAL INFORMATION

  • Has associated issue: [Question]CLI commands import_* and export_*  #13914
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@betodealmeida betodealmeida marked this pull request as ready for review April 1, 2021 20:53
@betodealmeida betodealmeida requested a review from hughhhh April 1, 2021 20:53
@codecov
Copy link

codecov bot commented Apr 2, 2021

Codecov Report

Merging #13921 (fd70622) into master (9156f08) will increase coverage by 0.04%.
The diff coverage is 86.84%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13921      +/-   ##
==========================================
+ Coverage   77.83%   77.87%   +0.04%     
==========================================
  Files         934      939       +5     
  Lines       47320    47774     +454     
  Branches     5913     5913              
==========================================
+ Hits        36831    37206     +375     
- Misses      10346    10425      +79     
  Partials      143      143              
Flag Coverage Δ
hive ?
mysql 81.02% <82.60%> (+0.45%) ⬆️
postgres 81.06% <82.60%> (+0.45%) ⬆️
presto ?
python 81.14% <82.60%> (+0.02%) ⬆️
sqlite 80.66% <82.60%> (+0.49%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../src/explore/components/controls/SelectControl.jsx 93.75% <ø> (ø)
.../explore/components/controls/TextControl/index.tsx 88.37% <ø> (ø)
superset/datasets/commands/importers/v1/utils.py 57.14% <40.00%> (+0.97%) ⬆️
...erset/dashboards/commands/importers/v1/__init__.py 98.50% <50.00%> (-1.50%) ⬇️
...ontrols/DndColumnSelectControl/DndFilterSelect.tsx 9.23% <83.33%> (ø)
...ontrols/DndColumnSelectControl/DndColumnSelect.tsx 22.58% <100.00%> (ø)
...ontrols/DndColumnSelectControl/DndMetricSelect.tsx 10.31% <100.00%> (ø)
superset/cli.py 50.99% <100.00%> (+17.32%) ⬆️
superset/dashboards/commands/importers/v1/utils.py 94.11% <100.00%> (ø)
superset/db_engines/hive.py 0.00% <0.00%> (-82.15%) ⬇️
... and 77 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 73a2cc3...fd70622. Read the comment docs.

superset/cli.py Outdated Show resolved Hide resolved
superset/cli.py Outdated Show resolved Hide resolved
Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

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

Yey!

@betodealmeida betodealmeida merged commit ffcacc3 into apache:master Apr 23, 2021
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
* fix: CLI for import/export

* Add tests

* Remove debug
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 labels Mar 12, 2024
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/XXL 🚢 1.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants