superset icon indicating copy to clipboard operation
superset copied to clipboard

feat: Flow for tables that already have a dataset

Open lyndsiWilliams opened this issue 2 years ago • 9 comments

SUMMARY

This implements a flow in the new dataset creation page for when a table already has a dataset. It uses a simplified dataset fetch in the AddDataset/index.tsx file to cross-reference with the table list. If the table has a dataset, it gets a warning icon in the left panel. If the table is selected, the table's columns are still displayed, but the "Create Dataset" button is disabled and it has an info banner at the top informing the user of the pre-existing dataset with a link to that dataset in the upper-left corner of the alert. Clicking the "View Dataset" button in this alert will bring the user to the explore view of the existing dataset in a new tab.

ANIMATED GIF / SCREENSHOT

Screenshot of selected table with existing dataset

Screenshot 2022-11-15 at 7 01 47 PM

Left panel warning icons

existingDSleftPanel

"View dataset"

existingDSViewDS

TESTING INSTRUCTIONS

  • Go to http://localhost:9000/dataset/add/?testing
  • Select a database and a schema
  • Observe that any tables in the left panel with a pre-existing dataset will have a warning icon
  • Click a table with a dataset
  • Observe that the "Create dataset" button is disabled and there is an info banner at the top informing of the pre-existing dataset
  • Click "View dataset" in the alert
  • Observe that you are taken to the explore view of the existing dataset in a new tab

ADDITIONAL INFORMATION

  • [ ] Has associated issue:
  • [ ] Required feature flags:
  • [ ] 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

lyndsiWilliams avatar Nov 16 '22 01:11 lyndsiWilliams

Codecov Report

Merging #22136 (11e2409) into master (6f6cb18) will decrease coverage by 1.59%. The diff coverage is 72.72%.

@@            Coverage Diff             @@
##           master   #22136      +/-   ##
==========================================
- Coverage   66.98%   65.39%   -1.60%     
==========================================
  Files        1832     1851      +19     
  Lines       69918    72903    +2985     
  Branches     7570     8661    +1091     
==========================================
+ Hits        46838    47672     +834     
- Misses      21122    23069    +1947     
- Partials     1958     2162     +204     
Flag Coverage Δ
hive 52.60% <ø> (ø)
mysql 78.15% <ø> (ø)
postgres 78.21% <ø> (ø)
presto 52.49% <ø> (ø)
python 78.69% <ø> (-2.69%) :arrow_down:
sqlite 76.67% <ø> (ø)
unit ?

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

Impacted Files Coverage Δ
...RUD/data/dataset/AddDataset/DatasetPanel/index.tsx 29.03% <ø> (ø)
...set-frontend/src/views/CRUD/data/dataset/styles.ts 100.00% <ø> (ø)
superset-frontend/src/views/CRUD/data/hooks.ts 57.69% <25.00%> (-5.95%) :arrow_down:
...d/src/views/CRUD/data/dataset/AddDataset/index.tsx 51.61% <41.66%> (-8.39%) :arrow_down:
...s/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx 87.32% <78.57%> (+0.65%) :arrow_up:
...a/dataset/AddDataset/DatasetPanel/DatasetPanel.tsx 86.95% <90.90%> (-4.72%) :arrow_down:
...D/data/dataset/AddDataset/DatasetPanel/fixtures.ts 100.00% <100.00%> (ø)
...iews/CRUD/data/dataset/AddDataset/Footer/index.tsx 39.39% <100.00%> (+1.89%) :arrow_up:
...set/advanced_data_type/plugins/internet_address.py 16.32% <0.00%> (-79.60%) :arrow_down:
superset/utils/pandas_postprocessing/boxplot.py 20.51% <0.00%> (-79.49%) :arrow_down:
... and 191 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Nov 16 '22 01:11 codecov[bot]

/testenv up

lyndsiWilliams avatar Nov 16 '22 02:11 lyndsiWilliams

@lyndsiWilliams Ephemeral environment spinning up at http://35.85.146.196:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

github-actions[bot] avatar Nov 16 '22 02:11 github-actions[bot]

@eschutho @eric-briscoe @lyndsiWilliams I have some nice suggestions!

  • This is the new dataset creation page and we have [SIP-61] - Improve the organization of front-end folders created by @michael-s-molina We can move this page into src/pages/addDataset and it'll be first component in src/pages after that we can smoothly move others page to the folder or if we create a new page for superset we can immediately do it in src/pages.
  • Creating Virtual Dataset on this new page. It will be good if we run our SQL query here we can see all metadata: columns types, used tables in the query, labels/aliases of columns and so on. Because in SQL Lab if you run sql query you can only see result data without columns metadata and others additional info.

What do you think about it?

EugeneTorap avatar Nov 18 '22 20:11 EugeneTorap

@eschutho @eric-briscoe @lyndsiWilliams I have some nice suggestions!

  • This is the new dataset creation page and we have [SIP-61] - Improve the organization of front-end folders created by @michael-s-molina We can move this page into src/pages/addDataset and it'll be first component in src/pages after that we can smoothly move others page to the folder or if we create a new page for superset we can immediately do it in src/pages.
  • Creating Virtual Dataset on this new page. It will be good if we run our SQL query here we can see all metadata: columns types, used tables in the query, labels/aliases of columns and so on. Because in SQL Lab if you run sql query you can only see result data without columns metadata and others additional info.

What do you think about it?

Hey @EugeneTorap!

  • This is a good suggestion, but it is a pretty substantial change for this PR. It will be better to do this in a future cleanup PR.
  • We currently don't have plans to add a virtual dataset from this flow. Now that we can create charts from a query in SQL Lab, the left panel in Explore should show you the column metadata info.

lyndsiWilliams avatar Nov 22 '22 02:11 lyndsiWilliams

/testenv up

AAfghahi avatar Nov 22 '22 15:11 AAfghahi

@AAfghahi Ephemeral environment spinning up at http://52.42.126.171:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

github-actions[bot] avatar Nov 22 '22 15:11 github-actions[bot]

/testenv up

lyndsiWilliams avatar Nov 22 '22 22:11 lyndsiWilliams

@lyndsiWilliams Ephemeral environment spinning up at http://54.202.36.48:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

github-actions[bot] avatar Nov 22 '22 22:11 github-actions[bot]

Ephemeral environment shutdown and build artifacts deleted.

github-actions[bot] avatar Dec 05 '22 21:12 github-actions[bot]