Skip to content

feat(datasets): reuse SQL Lab table browser for dataset creation - #46229

Open
Haseeb702 wants to merge 22 commits into
apache:masterfrom
Haseeb702:feat/bulk-import-ui-phase-1
Open

Haseeb702 wants to merge 22 commits into
apache:masterfrom
Haseeb702:feat/bulk-import-ui-phase-1

Conversation

@Haseeb702

@Haseeb702 Haseeb702 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

SUMMARY

The dataset creation page uses a different table selection UI compared to SQL Lab. This PR makes the two pages more consistent with each other by reusing SQL Lab components in dataset/add.

Users can now select a database connection and schema, and select a table to preview in a refined table browser reused from SQL Labs. The existing single dataset registration still functions the same.

This PR addresses the UI portion of the bulk import issue in #46230 and provides a foundation to add multi table import in a follow up PR.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before

image

After

Data Connection/Schema
image
Table Browser Selector
image

TESTING INSTRUCTIONS

  1. Open up the dataset/add page and click the database connection selector
  2. Choose a database connection and a schema then click select. Verify that the schema expands in the table browser and check if the columns of the table appear on the page. Check if other tables are able to be selected and if it clears the old table properly.
  3. Verify that it doesn't let you create and explore dataset if the table already has a dataset associated with it. Try selecting create and explore dataset button and see if it brings the user to the chart creation screen.
  4. Go onto the SQL Lab page and ensure that all data connection/schema selection and table browsing works just like before

ADDITIONAL INFORMATION

@github-actions github-actions Bot added the utsc2026 UTSC 2026 course contributions label Nov 16, 2026
@zsspan

zsspan commented Nov 16, 2026

Copy link
Copy Markdown

#46230

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.63319% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.83%. Comparing base (3df70cd) to head (9847e3b).
⚠️ Report is 47 commits behind head on master.

Files with missing lines Patch % Lines
...b/components/TableExploreTree/TreeNodeRenderer.tsx 92.30% 3 Missing ⚠️
...d/src/SqlLab/components/TableExploreTree/index.tsx 96.59% 3 Missing ⚠️
...c/features/datasets/AddDataset/LeftPanel/index.tsx 85.00% 3 Missing ⚠️
.../SqlLab/components/TableExploreTree/useTreeData.ts 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #46229      +/-   ##
==========================================
+ Coverage   56.55%   65.83%   +9.27%     
==========================================
  Files        3140     3147       +7     
  Lines      219075   220068     +993     
  Branches    51919    52139     +220     
==========================================
+ Hits       123908   144888   +20980     
+ Misses      93968    71748   -22220     
- Partials     1199     3432    +2233     
Flag Coverage Δ
hive 33.63% <ø> (-0.06%) ⬇️
javascript 82.98% <95.63%> (+0.10%) ⬆️
mysql 51.83% <ø> (?)
postgres 51.85% <ø> (?)
presto 35.32% <ø> (-0.05%) ⬇️
python 52.15% <ø> (+16.69%) ⬆️
sqlite 51.55% <ø> (?)

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Haseeb702 Haseeb702 changed the title Feat/bulk import UI phase 1 feat(datasets): reuse SQL Lab table browser for dataset creation Nov 18, 2026
@github-actions github-actions Bot added the i18n Namespace | Anything related to localization label Nov 18, 2026
@Haseeb702
Haseeb702 force-pushed the feat/bulk-import-ui-phase-1 branch from e3c1867 to d1e7d04 Compare November 18, 2026 22:27
@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Nov 19, 2026
@github-actions github-actions Bot added requires:rebase Requires rebasing on top of current master and removed requires:rebase Requires rebasing on top of current master labels Nov 19, 2026
@Haseeb702
Haseeb702 marked this pull request as ready for review November 21, 2026 02:40
supportsSchemas={dataset.db.supports_schemas}
schema={dataset.schema ?? undefined}
catalog={dataset.catalog}
onPreviewTable={onPreviewTable}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: On databases without schemas, the browser supplies a synthetic empty schema; this callback stores it, and dataset creation sends schema: '', which can make registration treat it as a real schema.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Api mismatch

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/features/datasets/AddDataset/LeftPanel/index.tsx
**Line:** 100:100
**Comment:**
	*Api Mismatch: On databases without schemas, the browser supplies a synthetic empty schema; this callback stores it, and dataset creation sends `schema: ''`, which can make registration treat it as a real schema.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

new Set(
tables
.filter(({ queryEditorId: qeId }) => editorId === qeId)
.map(({ dbId, schema, name }) => `${dbId}:${schema}:${name}`),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: These pin keys omit catalog, so same-named tables in separate catalogs appear pinned together; the unpin lookup can also remove the wrong catalog's entry.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/SqlLab/components/TableExploreTree/index.tsx
**Line:** 587:587
**Comment:**
	*Logic Error: These pin keys omit `catalog`, so same-named tables in separate catalogs appear pinned together; the unpin lookup can also remove the wrong catalog's entry.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai-for-open-source

codeant-ai-for-open-source Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; the reviewed concerns are addressed in the current code.

Assessed commit: 9847e3b2c243

@Haseeb702

Copy link
Copy Markdown
Contributor Author

We changed the white opacity selection for add/dataset so that it is only white when selected. Also chose to make the table dropdown close when another table is selected in the table browser.

@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Nov 25, 2026

@rusackas rusackas 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.

Thanks @Haseeb702, nice to see SQL Lab and the dataset page sharing one browser!

One thing before approving... the old SQL Lab popover sent '' when the schema was cleared, but applySelection passes undefined, and the tab-state PUT skips undefined fields (here). So switching databases without picking a schema seems like it'd leave the old schema saved server-side. Mind keeping the '' on the SQL Lab path?

Also, was dropping the "This table already has a dataset" marker from the table list intentional? The footer still blocks it, but the hint was handy.

@Haseeb702

Copy link
Copy Markdown
Contributor Author

Hi @rusackas, thanks for the feedback! We added back the '' on the SQL Lab path and the "This table already has a dataset" marker was added back as well.

@rusackas rusackas 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.

Thanks @Haseeb702 for turning those two around! I gave it a deeper pass and found one more thing on the SQL Lab side. DatabaseSelectorPopover pulls onDbChange/onCatalogChange/onSchemaChange out of the props before handing the rest to the trigger DatabaseSelector, so the trigger's auto-select and clear-stale-schema logic no longer reports back to anyone. An editor on a database with a single schema would stay schema-less, and a saved schema that no longer exists would stick around until someone opens the popover. Could the trigger keep those callbacks?

Couple of smaller ones on the dataset page inline.

const schemaId = dbId && schema ? `schema:${dbId}:${schema}` : undefined;
if (revealedSchemaRef.current === schemaId) return;
revealedSchemaRef.current = schemaId;
setSearchTerm('');

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.

This clears the filter whenever schema changes, and on the dataset page clicking a table under another schema changes it. So filtering for orders and clicking the match under sales wipes the search right after the click. Maybe only reset it when the schema change didn't come from the tree itself?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, updated TableBrowser to record when a schema changes so that it resets when schema change didn't come from the tree.

<Divider style={{ margin: 0 }} />
{dataset?.db ? (
<TableBrowser
key={`${dataset.db.id}:${dataset.catalog ?? ''}`}

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.

Since this is only keyed on db/catalog, the tree never hears that table_name got cleared (e.g. after picking another schema in the popover). The old table stays highlighted and expanded while the panel shows nothing selected. Passing the selected table down should keep the two in sync.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a selectedTable prop so that when table_name is cleared, the tree closes and deselects the old table.

opacity: ${columnOpacity};
`}
data-selected={node.isSelected}
onClick={() => node.select()}

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.

In preview mode, clicking a column selects it, which deselects the table, so the table dims even though it's still the dataset's table. Should column clicks skip node.select() here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. We made the column click skip when in preview mode.

@Haseeb702

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed review @rusackas! We looked over the review comments and made some fixes to the code based on your feedback.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

i18n Namespace | Anything related to localization review:draft size/XXL utsc2026 UTSC 2026 course contributions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants