You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/05/10 14:56:16 UTC

[GitHub] [superset] diegomedina248 opened a new pull request, #20013: fix: The dynamic form to connect to Snowflake DB is not returning any errors

diegomedina248 opened a new pull request, #20013:
URL: https://github.com/apache/superset/pull/20013

   ### SUMMARY
   There are two ways to create a connection with a Snowflake DB:
   
   Using the dynamic form.
   Using a SQLAlchemy URI string.
   However, the dynamic form is not displaying authentication errors to the user, in case the authentication fails.
   
   This PR reintroduces the fixes from #19491 that were overridden in #19165
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   Before:
   
   https://user-images.githubusercontent.com/17252075/167658332-b60cfbd3-91c6-4090-b618-dbdb33f33f56.mov
   
   After:
   
   https://user-images.githubusercontent.com/17252075/167658212-592ab2b0-e295-4bea-ad82-2d1aaffe2e79.mp4
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rusackas commented on a diff in pull request #20013: fix: The dynamic form to connect to Snowflake DB is not returning any errors

Posted by GitBox <gi...@apache.org>.
rusackas commented on code in PR #20013:
URL: https://github.com/apache/superset/pull/20013#discussion_r872682528


##########
superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx:
##########
@@ -1083,15 +1085,23 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
 
   // eslint-disable-next-line consistent-return
   const errorAlert = () => {
+    let alertErrors: string[] = [];
     if (isEmpty(dbErrors) === false) {
-      const message: Array<string> =
-        typeof dbErrors === 'object' ? Object.values(dbErrors) : [];
+      alertErrors = typeof dbErrors === 'object' ? Object.values(dbErrors) : [];
+    } else if (db?.engine === Engines.Snowflake) {
+      alertErrors =
+        validationErrors?.error_type === 'GENERIC_DB_ENGINE_ERROR'
+          ? [validationErrors?.description]
+          : [];
+    }
+
+    if (alertErrors.length) {
       return (
         <Alert
           type="error"
           css={(theme: SupersetTheme) => antDErrorAlertStyles(theme)}
           message={t('Database Creation Error')}
-          description={message?.[0] || dbErrors}
+          description={t(alertErrors[0])}

Review Comment:
   Looking above at line 1095, it seems there's a condition where `alertErrors` might be `[]`, in which case this would be translating/displaying `undefined` right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #20013: fix: The dynamic form to connect to Snowflake DB is not returning any errors

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #20013:
URL: https://github.com/apache/superset/pull/20013#issuecomment-1122582547

   # [Codecov](https://codecov.io/gh/apache/superset/pull/20013?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#20013](https://codecov.io/gh/apache/superset/pull/20013?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a7de37d) into [master](https://codecov.io/gh/apache/superset/commit/b7cff8335b6c0ac5498f9c788c5619e5445b28ad?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b7cff83) will **decrease** coverage by `0.00%`.
   > The diff coverage is `9.09%`.
   
   > :exclamation: Current head a7de37d differs from pull request most recent head caf46c0. Consider uploading reports for the commit caf46c0 to get more accurate results
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #20013      +/-   ##
   ==========================================
   - Coverage   66.28%   66.28%   -0.01%     
   ==========================================
     Files        1712     1712              
     Lines       63968    63969       +1     
     Branches     6731     6732       +1     
   ==========================================
   - Hits        42404    42403       -1     
   - Misses      19853    19855       +2     
     Partials     1711     1711              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | javascript | `51.27% <9.09%> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/20013?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...c/views/CRUD/data/database/DatabaseModal/index.tsx](https://codecov.io/gh/apache/superset/pull/20013/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhYmFzZS9EYXRhYmFzZU1vZGFsL2luZGV4LnRzeA==) | `32.15% <9.09%> (-0.37%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/20013?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/20013?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [b7cff83...caf46c0](https://codecov.io/gh/apache/superset/pull/20013?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sadpandajoe commented on pull request #20013: fix: The dynamic form to connect to Snowflake DB is not returning any errors

Posted by GitBox <gi...@apache.org>.
sadpandajoe commented on PR #20013:
URL: https://github.com/apache/superset/pull/20013#issuecomment-1127955840

   🏷️ preset:2022.19


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rusackas commented on a diff in pull request #20013: fix: The dynamic form to connect to Snowflake DB is not returning any errors

Posted by GitBox <gi...@apache.org>.
rusackas commented on code in PR #20013:
URL: https://github.com/apache/superset/pull/20013#discussion_r872692655


##########
superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx:
##########
@@ -1083,15 +1085,23 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
 
   // eslint-disable-next-line consistent-return
   const errorAlert = () => {
+    let alertErrors: string[] = [];
     if (isEmpty(dbErrors) === false) {
-      const message: Array<string> =
-        typeof dbErrors === 'object' ? Object.values(dbErrors) : [];
+      alertErrors = typeof dbErrors === 'object' ? Object.values(dbErrors) : [];
+    } else if (db?.engine === Engines.Snowflake) {
+      alertErrors =
+        validationErrors?.error_type === 'GENERIC_DB_ENGINE_ERROR'
+          ? [validationErrors?.description]
+          : [];
+    }
+
+    if (alertErrors.length) {
       return (
         <Alert
           type="error"
           css={(theme: SupersetTheme) => antDErrorAlertStyles(theme)}
           message={t('Database Creation Error')}
-          description={message?.[0] || dbErrors}
+          description={t(alertErrors[0])}

Review Comment:
   lol 🤦 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] diegomedina248 commented on a diff in pull request #20013: fix: The dynamic form to connect to Snowflake DB is not returning any errors

Posted by GitBox <gi...@apache.org>.
diegomedina248 commented on code in PR #20013:
URL: https://github.com/apache/superset/pull/20013#discussion_r872684758


##########
superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx:
##########
@@ -1083,15 +1085,23 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
 
   // eslint-disable-next-line consistent-return
   const errorAlert = () => {
+    let alertErrors: string[] = [];
     if (isEmpty(dbErrors) === false) {
-      const message: Array<string> =
-        typeof dbErrors === 'object' ? Object.values(dbErrors) : [];
+      alertErrors = typeof dbErrors === 'object' ? Object.values(dbErrors) : [];
+    } else if (db?.engine === Engines.Snowflake) {
+      alertErrors =
+        validationErrors?.error_type === 'GENERIC_DB_ENGINE_ERROR'
+          ? [validationErrors?.description]
+          : [];
+    }
+
+    if (alertErrors.length) {
       return (
         <Alert
           type="error"
           css={(theme: SupersetTheme) => antDErrorAlertStyles(theme)}
           message={t('Database Creation Error')}
-          description={message?.[0] || dbErrors}
+          description={t(alertErrors[0])}

Review Comment:
   we're checking for content in 1098



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rusackas merged pull request #20013: fix: The dynamic form to connect to Snowflake DB is not returning any errors

Posted by GitBox <gi...@apache.org>.
rusackas merged PR #20013:
URL: https://github.com/apache/superset/pull/20013


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] stephenLYZ commented on a diff in pull request #20013: fix: The dynamic form to connect to Snowflake DB is not returning any errors

Posted by GitBox <gi...@apache.org>.
stephenLYZ commented on code in PR #20013:
URL: https://github.com/apache/superset/pull/20013#discussion_r869378860


##########
superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx:
##########
@@ -1070,15 +1072,23 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
 
   // eslint-disable-next-line consistent-return
   const errorAlert = () => {
+    let alertErrors: string[] = [];
     if (isEmpty(dbErrors) === false) {
-      const message: Array<string> =
-        typeof dbErrors === 'object' ? Object.values(dbErrors) : [];
+      alertErrors = typeof dbErrors === 'object' ? Object.values(dbErrors) : [];
+    } else if (db?.engine === Engines.Snowflake) {
+      alertErrors =
+        validationErrors?.error_type === 'GENERIC_DB_ENGINE_ERROR'
+          ? [validationErrors?.description]
+          : [];
+    }
+
+    if (alertErrors.length) {
       return (
         <Alert
           type="error"
           css={(theme: SupersetTheme) => antDErrorAlertStyles(theme)}
           message={t('Database Creation Error')}
-          description={message?.[0] || dbErrors}
+          description={alertErrors?.[0]}

Review Comment:
   Looks like `?.` is an unnecessary logic and it's better to use `t` function to wrap it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org