Skip to content

feat: export charts as ZIP files - #11349

Merged
betodealmeida merged 4 commits into
apache:masterfrom
betodealmeida:SO-1003
Oct 22, 2020
Merged

betodealmeida merged 4 commits into
apache:masterfrom
betodealmeida:SO-1003

Conversation

@betodealmeida

Copy link
Copy Markdown
Member

SUMMARY

Add a new endpoint to export charts as a Zip file, following #11167.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TEST PLAN

Added unit tests for ExportChartsCommand and for the API endpoint.

ADDITIONAL INFORMATION

@betodealmeida betodealmeida changed the title Export charts as Zip file feat: export charts as Zip file Oct 20, 2020
@betodealmeida
betodealmeida marked this pull request as ready for review October 20, 2020 20:21
@betodealmeida
betodealmeida requested a review from hughhhh October 20, 2020 20:22
@codecov-io

codecov-io commented Oct 20, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #11349 into master will increase coverage by 4.24%.
The diff coverage is 97.01%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11349      +/-   ##
==========================================
+ Coverage   61.65%   65.90%   +4.24%     
==========================================
  Files         839      840       +1     
  Lines       39966    40035      +69     
  Branches     3662     3662              
==========================================
+ Hits        24643    26385    +1742     
+ Misses      15142    13549    -1593     
+ Partials      181      101      -80     
Flag Coverage Δ
#cypress 55.86% <ø> (?)
#javascript 62.67% <ø> (ø)
#python 61.14% <97.01%> (+0.09%) ⬆️

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

Impacted Files Coverage Δ
superset/datasets/api.py 92.73% <ø> (ø)
superset/charts/commands/export.py 95.12% <95.12%> (ø)
superset/charts/api.py 76.98% <100.00%> (+2.42%) ⬆️
superset/charts/schemas.py 100.00% <100.00%> (ø)
...et-frontend/src/SqlLab/components/LimitControl.tsx 89.36% <0.00%> (-1.95%) ⬇️
.../src/components/dataViewCommon/TableCollection.tsx 100.00% <0.00%> (ø)
...-frontend/src/datasource/ChangeDatasourceModal.tsx 74.19% <0.00%> (+0.42%) ⬆️
...rontend/src/SqlLab/components/AceEditorWrapper.tsx 60.75% <0.00%> (+1.26%) ⬆️
...ashboard/components/gridComponents/ChartHolder.jsx 79.16% <0.00%> (+1.38%) ⬆️
... and 172 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 00e3944...e92de4e. Read the comment docs.

@betodealmeida betodealmeida changed the title feat: export charts as Zip file feat: export charts as ZIP files Oct 20, 2020
Comment thread superset/charts/api.py
@protect()
@safe
@statsd_metrics
@rison(get_export_ids_schema)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah, thanks! #TIL!

I register the spec in #11373, I'll update the schemas in that PR.

Comment thread superset/datasets/api.py
@rison(get_export_ids_schema)
def export(self, **kwargs: Any) -> Response:
"""Export dashboards
"""Export datasets

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ups!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

"Let him who has never copied-and-pasted in a rush cast the first stone"

try:
payload["params"] = json.loads(payload["params"])
except json.decoder.JSONDecodeError:
pass

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

add logger.warn to know loading the params object failed

@dpgaspar dpgaspar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@betodealmeida
betodealmeida changed the base branch from SO-1009 to master October 22, 2020 17:35
@betodealmeida
betodealmeida merged commit 633355a into apache:master Oct 22, 2020
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
* Export datasets as ZIP files

* Add logging when failing to parse extra

* Export charts as Zip file

* Fix lint
EBoisseauSierra added a commit to EBoisseauSierra/superset that referenced this pull request Sep 6, 2021
NB: We're here discussing the `import-dashboards` CLI with the
`VERSIONED_EXPORT` feature flag *turned ON* — cf. apache#11349

Currently, `superset import-dashboards` looks up at the required
databases (`export/databases/*.yaml`).
If the db URI (`sqlalchemy_uri` key) contains a masked password, then
the script looks up for already existing databases record.

The match is currently done using db UUID. However, '<insert how UUIDs
are generated>', the same db connection (same URI) might not have the
same UUID on the export instance, and on the import one. (Cf. apache#16395)

Thus, we propose to lookup for the db _name_ instead — this would also
allow for updating the db URI between the export and the import
instance.

Note: this change should not be propagated for the demo db, as its UUID
has been frozen in apache#15724.

Signed-off-by: Étienne Boisseau-Sierra <[email protected]>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.0.0 First shipped in 1.0.0 labels Mar 12, 2024
qfcwell pushed a commit to qfcwell/superset that referenced this pull request May 12, 2026
* Export datasets as ZIP files

* Add logging when failing to parse extra

* Export charts as Zip file

* Fix lint
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/L 🚢 1.0.0 First shipped in 1.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants