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

feat: Database Connection UI #14881

Merged
merged 176 commits into from
Jul 1, 2021
Merged

feat: Database Connection UI #14881

merged 176 commits into from
Jul 1, 2021

Conversation

hughhhh
Copy link
Member

@hughhhh hughhhh commented May 27, 2021

SUMMARY

Fully revamped the DB Connection Flow for users to easily add their databases to the metastore. With the new DB Connection Modal, we are able to build custom forms (dynamic forms) for whatever databases/engines we want. If their isn't a dynamic form available all dbs default to sqlalchemy for connecting.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen Shot 2021-06-29 at 9 06 40 AM

Screen.Recording.2021-06-22.at.5.24.03.PM.mov

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • 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

@codecov
Copy link

codecov bot commented May 27, 2021

Codecov Report

Merging #14881 (bd97955) into master (7889564) will decrease coverage by 0.33%.
The diff coverage is 57.01%.

❗ Current head bd97955 differs from pull request most recent head b20882f. Consider uploading reports for the commit b20882f to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14881      +/-   ##
==========================================
- Coverage   77.16%   76.82%   -0.34%     
==========================================
  Files         975      976       +1     
  Lines       50865    51217     +352     
  Branches     6740     6893     +153     
==========================================
+ Hits        39251    39349      +98     
- Misses      11398    11649     +251     
- Partials      216      219       +3     
Flag Coverage Δ
hive ?
javascript 71.53% <55.76%> (-0.33%) ⬇️
mysql 81.65% <71.05%> (+<0.01%) ⬆️
postgres 81.67% <71.05%> (+<0.01%) ⬆️
python 81.75% <71.05%> (-0.29%) ⬇️
sqlite 81.28% <65.78%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
...rset-frontend/src/components/ErrorMessage/types.ts 100.00% <ø> (ø)
...rset-frontend/src/components/InfoTooltip/index.tsx 100.00% <ø> (ø)
...RUD/data/database/DatabaseModal/SqlAlchemyForm.tsx 92.30% <0.00%> (-7.70%) ⬇️
...set-frontend/src/views/CRUD/data/database/types.ts 100.00% <ø> (ø)
...set-frontend/src/views/CRUD/welcome/EmptyState.tsx 87.17% <ø> (ø)
...t-frontend/src/views/CRUD/welcome/SavedQueries.tsx 60.60% <0.00%> (ø)
superset/config.py 97.03% <ø> (ø)
superset/databases/commands/exceptions.py 94.00% <ø> (ø)
superset-frontend/src/views/CRUD/hooks.ts 48.23% <35.00%> (-4.58%) ⬇️
superset/db_engine_specs/bigquery.py 87.75% <37.50%> (-2.18%) ⬇️
... and 29 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 7889564...b20882f. Read the comment docs.

@hughhhh hughhhh changed the title [WIP] feat: Database Connection UI feat: Database Connection UI May 28, 2021
eschutho and others added 4 commits June 1, 2021 14:02
* poc picker for db selection

* working select

* setup is loading for available dbs and step1 view

* fix on close

* update on fetch

* remove unneeded code

* add some styls
@hughhhh hughhhh force-pushed the pexdax/db-connection-ui branch from 2d2dd39 to ef63e3c Compare June 1, 2021 18:03
id="selectedFile"
className="input-upload"
type="file"
onChange={async event => {
Copy link
Member

Choose a reason for hiding this comment

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

small nit, but this is a fairly long function in this event handler. Not necessarily required now, but I think it would read better if we pulled this out into a named function instead.

Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

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

This looks great! I left a few nits and TODOs that we can tackle after merging.

Comment on lines 1087 to 1092
PREFERRED_DATABASES: List[str] = [
# "PostgreSQL",
# "Presto",
# "MySQL",
# "SQLite",
"PostgreSQL",
"Presto",
"MySQL",
"SQLite",
# etc.
Copy link
Member

Choose a reason for hiding this comment

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

Do we wanna curate this list better? I just wrote these of the top of my head.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think these are fine for now

@yousoph what do you think?

@@ -35,6 +35,8 @@
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
from superset.models.core import Database

BYPASS_VALIDATION_ENGINES = ["bigquery"]
Copy link
Member

Choose a reason for hiding this comment

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

Nit: make this a set

Comment on lines 282 to 286
serialized_encrypted_extra = (
data.get("encrypted_extra", "{}")
if data.get("encrypted_extra")
else "{}"
)
Copy link
Member

Choose a reason for hiding this comment

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

Nit:

Suggested change
serialized_encrypted_extra = (
data.get("encrypted_extra", "{}")
if data.get("encrypted_extra")
else "{}"
)
serialized_encrypted_extra = data.get("encrypted_extra") or "{}"

Comment on lines +102 to +103
Your database was successfully connected! Here are some optional
settings for your database
Copy link
Member

Choose a reason for hiding this comment

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

All the strings in this file need to be translatable, but we can do that later.

@@ -59,20 +60,20 @@ const ExtraOptions = ({
<div>
<h4>SQL Lab</h4>
<p className="helper">
Configure how this database will function in SQL Lab.
Adjust how this database will interact with SQL Lab.
Copy link
Member

Choose a reason for hiding this comment

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

A few more here that need to be translatable.

betodealmeida and others added 9 commits June 30, 2021 16:57
* fix: add icons (#15122)

* added alerts

* revisions

* added icon

* spinner

* added to error map
* fix: add icons (#15122)

* added alerts

* revisions

* added icon

* spinner

* this will test

* fixed test
* send parameters if they are available

* fix bigquery sqlalchem issue

* fix casting
@hughhhh hughhhh merged commit d4480f5 into master Jul 1, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2021

Ephemeral environment shutdown and build artifacts deleted.

cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
@rusackas rusackas deleted the pexdax/db-connection-ui branch January 30, 2023 19:22
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.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.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants