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

refactor(DB Connections): Build Snowflake Dynamic Form #16875

Merged

Conversation

AAfghahi
Copy link
Member

@AAfghahi AAfghahi commented Sep 28, 2021

SUMMARY

This moves all fields that are not in BasicParametersSchema into their own file in order to make DB Connections Form smaller. The reason for doing this because we are going to be parsing Snowflake's sql alchemy uri in order to enable it for the dynamic form.

This PR also builds up build_sql_alchemy_uri, and get_parameters_from_uri in the Snowflake engine spec.

Lastly, as part of a larger refactor of the DB connection form, I created a validatedInputField that is a sort of go to for any basic string fields that we may want to add to the DB Connection Form.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

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

@AAfghahi AAfghahi changed the base branch from master to pexdax/snowflake September 28, 2021 17:52
@AAfghahi AAfghahi force-pushed the arash/refactorDBConnections branch 2 times, most recently from 6cd3cc4 to 14ae966 Compare September 28, 2021 18:22
@codecov
Copy link

codecov bot commented Sep 28, 2021

Codecov Report

Merging #16875 (a37bb06) into pexdax/snowflake (9fa95ba) will decrease coverage by 0.03%.
The diff coverage is 54.54%.

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

@@                 Coverage Diff                  @@
##           pexdax/snowflake   #16875      +/-   ##
====================================================
- Coverage             76.82%   76.78%   -0.04%     
====================================================
  Files                  1021     1022       +1     
  Lines                 54903    54899       -4     
  Branches               7487     7488       +1     
====================================================
- Hits                  42179    42154      -25     
- Misses                12477    12498      +21     
  Partials                247      247              
Flag Coverage Δ
hive ?
javascript 71.13% <57.14%> (+<0.01%) ⬆️
presto ?

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

Impacted Files Coverage Δ
superset/db_engine_specs/snowflake.py 80.37% <33.33%> (+5.16%) ⬆️
...s/CRUD/data/database/DatabaseModal/ExtraFields.tsx 50.00% <50.00%> (ø)
.../database/DatabaseModal/DatabaseConnectionForm.tsx 49.15% <100.00%> (+1.53%) ⬆️
superset/datasets/dao.py 96.50% <100.00%> (ø)
superset/models/core.py 89.26% <100.00%> (+2.43%) ⬆️
superset/db_engines/hive.py 0.00% <0.00%> (-85.19%) ⬇️
superset/db_engine_specs/hive.py 69.76% <0.00%> (-17.06%) ⬇️
superset/db_engine_specs/presto.py 83.47% <0.00%> (-6.91%) ⬇️
superset/views/database/mixins.py 81.03% <0.00%> (-1.73%) ⬇️
superset/connectors/sqla/models.py 85.59% <0.00%> (-1.66%) ⬇️
... and 15 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 9fa95ba...3e7d795. Read the comment docs.

copyPaste,
}

export const accountField = ({
Copy link
Member

Choose a reason for hiding this comment

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

lets split these out into individual files

@AAfghahi AAfghahi force-pushed the arash/refactorDBConnections branch from 14ae966 to 8ab698b Compare September 28, 2021 23:03
@AAfghahi AAfghahi force-pushed the arash/refactorDBConnections branch from 8ab698b to e4410c5 Compare September 29, 2021 19:23
@AAfghahi AAfghahi force-pushed the arash/refactorDBConnections branch 3 times, most recently from 023c811 to c742f99 Compare September 29, 2021 20:04
@AAfghahi AAfghahi force-pushed the arash/refactorDBConnections branch from c742f99 to 418a9d6 Compare September 29, 2021 20:14
@AAfghahi AAfghahi changed the title refactor(DB Connections): Arash/refactor db connections refactor(DB Connections): Build Snowflake Dynamic Form Sep 29, 2021
Copy link
Member

@hughhhh hughhhh left a comment

Choose a reason for hiding this comment

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

looks good just clean up the import

@@ -55,7 +55,7 @@ import {
import Loading from 'src/components/Loading';
import ExtraOptions from './ExtraOptions';
import SqlAlchemyForm from './SqlAlchemyForm';
import DatabaseConnectionForm from './DatabaseConnectionForm';
import DatabaseConnectionForm from './DatabaseConnectionForm/DatabaseConnectionForm';
Copy link
Member

Choose a reason for hiding this comment

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

Rename /DatabaseConnectionForm/DatabaseConnectionForm to /DatabaseConnectionForm/index.tsx so we can just import like this:

import DatabaseConnectionForm from './DatabaseConnectionForm/DatabaseConnectionForm';

@AAfghahi AAfghahi force-pushed the arash/refactorDBConnections branch from 800856f to 3e7d795 Compare September 30, 2021 16:10
@hughhhh hughhhh merged commit 62774d2 into apache:pexdax/snowflake Sep 30, 2021
hughhhh added a commit that referenced this pull request Oct 17, 2021
* update snowflake spec for dyanmic form

* feat(snowflake): Snowflake dynamic form (#16861)

* snowflake frontend

* snowflake frontend

* refactor(DB Connections): Build Snowflake Dynamic Form (#16875)

* moved all non-BasicParameters into own field

* refactored DB Connection Form made ValidatedInput

* quick fix

* fixed ValidatedInputField (#16934)

* add logic to check for required fields (#17022)

* fix

* fix linting

* remove host

* Update EncryptedField.tsx

Co-authored-by: AAfghahi <48933336+AAfghahi@users.noreply.github.com>
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
* update snowflake spec for dyanmic form

* feat(snowflake): Snowflake dynamic form (apache#16861)

* snowflake frontend

* snowflake frontend

* refactor(DB Connections): Build Snowflake Dynamic Form (apache#16875)

* moved all non-BasicParameters into own field

* refactored DB Connection Form made ValidatedInput

* quick fix

* fixed ValidatedInputField (apache#16934)

* add logic to check for required fields (apache#17022)

* fix

* fix linting

* remove host

* Update EncryptedField.tsx

Co-authored-by: AAfghahi <48933336+AAfghahi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants