Skip to content

feat: load examples from config instead of code #12026

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

Merged
merged 3 commits into from
Dec 15, 2020

Conversation

betodealmeida
Copy link
Member

SUMMARY

Currently the examples that come with Superset are all generated by Python scripts, making modifying the existing examples or creating new ones unnecessarily complicated.

With the new export/import functionality from SIP-54 we can store the examples in the repo as YAML files instead of code. This way the examples can be easily modified, and new examples can be created inside Superset, exported and added to the repo.

In this PR I moved the "Unicode test" example to YAML files. Doing so required a few modifications, namely, adding a data attribute to the dataset config pointing to a URL where the data can be download as a CSV. This is similar to how load_examples currently work, with the difference that we don't know the column types a priori, so they need to be inferred from the dataset metadata.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TEST PLAN

I loaded the examples, and verified that the unicode test is imported and set up correctly.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@codecov-io
Copy link

codecov-io commented Dec 13, 2020

Codecov Report

Merging #12026 (a115395) into master (e0079bb) will increase coverage by 0.05%.
The diff coverage is 45.04%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12026      +/-   ##
==========================================
+ Coverage   63.72%   63.78%   +0.05%     
==========================================
  Files         956      474     -482     
  Lines       46941    29270   -17671     
  Branches     4589        0    -4589     
==========================================
- Hits        29915    18669   -11246     
+ Misses      16842    10601    -6241     
+ Partials      184        0     -184     
Flag Coverage Δ
javascript ?
python 63.78% <45.04%> (-0.59%) ⬇️

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

Impacted Files Coverage Δ
superset/cli.py 34.78% <0.00%> (+0.09%) ⬆️
superset/examples/utils.py 31.57% <31.57%> (ø)
superset/datasets/commands/importers/v1/utils.py 55.93% <39.28%> (-15.04%) ⬇️
superset/commands/importers/v1/examples.py 45.45% <45.45%> (ø)
superset/commands/importers/v1/__init__.py 95.94% <100.00%> (ø)
superset/commands/importers/v1/utils.py 86.11% <100.00%> (ø)
...erset/dashboards/commands/importers/v1/__init__.py 100.00% <100.00%> (ø)
superset/dashboards/commands/importers/v1/utils.py 93.75% <100.00%> (+2.08%) ⬆️
superset/datasets/schemas.py 96.46% <100.00%> (+0.03%) ⬆️
superset/examples/__init__.py 100.00% <100.00%> (ø)
... and 493 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 e0079bb...a115395. Read the comment docs.

Copy link
Member

@bkyryliuk bkyryliuk left a comment

Choose a reason for hiding this comment

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

nice improvement !

@betodealmeida betodealmeida merged commit 5e811a1 into apache:master Dec 15, 2020
@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
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/XL 🚢 1.0.0 First shipped in 1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants