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/10/31 11:19:07 UTC
[GitHub] [superset] villebro opened a new pull request, #21982: chore: bubble up more db error messages
villebro opened a new pull request, #21982:
URL: https://github.com/apache/superset/pull/21982
### SUMMARY
Many small improvements to error handling:
- Map exceptions from the `requests` library to Superset exceptions for both Trino and Druid (both use `requests` for communication, and has "clean" error messages that shouldn't contain sensitive info)
- In SQL Lab, both table and schema metadata requests only show a generic error message on failure; this adds the error message to provide additional context on what the error was.
- In Explore, unexpected exceptions are not shown in the error toast. Similar to SQL Lab table and schema errors, this adds the sanitized error message to the Explore error toast if available.
- `BaseEngineSpec` was missing `get_dbapi_mapped_exception` in many methods that potentially raised database-specific exceptions - these are added here + exception chaining as recommended [here](https://docs.python.org/3/tutorial/errors.html#exception-chaining).
### AFTER
When trying to Explore a dataset that has an error, the toast now shows the error message:

Error messages are also surfaced in SQL Lab when fetching schemas/tables:

### BEFORE
On Explore, a generic uninformative error was toasted:

In SQL Lab, previously the table error message wasn't always raised, and no error context was available for either schema or table error toasts:

### 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] codecov[bot] commented on pull request #21982: chore: bubble up more db error messages
Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #21982:
URL: https://github.com/apache/superset/pull/21982#issuecomment-1296961117
# [Codecov](https://codecov.io/gh/apache/superset/pull/21982?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 [#21982](https://codecov.io/gh/apache/superset/pull/21982?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (cdaa657) into [master](https://codecov.io/gh/apache/superset/commit/66f166be0f5485b9a51c80aef703b9d8d0fd93d5?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (66f166b) will **decrease** coverage by `11.50%`.
> The diff coverage is `32.81%`.
```diff
@@ Coverage Diff @@
## master #21982 +/- ##
===========================================
- Coverage 66.92% 55.42% -11.51%
===========================================
Files 1807 1807
Lines 69238 69267 +29
Branches 7407 7407
===========================================
- Hits 46338 38391 -7947
- Misses 20991 28967 +7976
Partials 1909 1909
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `?` | |
| mysql | `?` | |
| presto | `52.79% <18.00%> (-0.03%)` | :arrow_down: |
| python | `57.59% <26.00%> (-23.83%)` | :arrow_down: |
| sqlite | `?` | |
| unit | `51.07% <26.00%> (-0.03%)` | :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/21982?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [superset-frontend/src/explore/ExplorePage.tsx](https://codecov.io/gh/apache/superset/pull/21982/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-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvRXhwbG9yZVBhZ2UudHN4) | `0.00% <0.00%> (ø)` | |
| [...uperset-frontend/src/utils/getClientErrorObject.ts](https://codecov.io/gh/apache/superset/pull/21982/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-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3V0aWxzL2dldENsaWVudEVycm9yT2JqZWN0LnRz) | `58.53% <ø> (ø)` | |
| [superset/db\_engine\_specs/base.py](https://codecov.io/gh/apache/superset/pull/21982/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-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2Jhc2UucHk=) | `74.25% <0.00%> (-15.45%)` | :arrow_down: |
| [superset/views/core.py](https://codecov.io/gh/apache/superset/pull/21982/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-c3VwZXJzZXQvdmlld3MvY29yZS5weQ==) | `34.69% <0.00%> (-41.37%)` | :arrow_down: |
| [superset/databases/api.py](https://codecov.io/gh/apache/superset/pull/21982/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-c3VwZXJzZXQvZGF0YWJhc2VzL2FwaS5weQ==) | `52.30% <14.28%> (-42.68%)` | :arrow_down: |
| [superset/models/core.py](https://codecov.io/gh/apache/superset/pull/21982/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-c3VwZXJzZXQvbW9kZWxzL2NvcmUucHk=) | `78.93% <25.00%> (-10.86%)` | :arrow_down: |
| [superset/explore/commands/get.py](https://codecov.io/gh/apache/superset/pull/21982/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-c3VwZXJzZXQvZXhwbG9yZS9jb21tYW5kcy9nZXQucHk=) | `65.30% <28.57%> (-25.23%)` | :arrow_down: |
| [superset/db\_engine\_specs/druid.py](https://codecov.io/gh/apache/superset/pull/21982/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-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2RydWlkLnB5) | `52.38% <66.66%> (-30.38%)` | :arrow_down: |
| [superset/db\_engine\_specs/trino.py](https://codecov.io/gh/apache/superset/pull/21982/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-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3RyaW5vLnB5) | `38.13% <66.66%> (-30.90%)` | :arrow_down: |
| [...frontend/src/components/DatabaseSelector/index.tsx](https://codecov.io/gh/apache/superset/pull/21982/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-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRGF0YWJhc2VTZWxlY3Rvci9pbmRleC50c3g=) | `92.42% <80.00%> (ø)` | |
| ... and [296 more](https://codecov.io/gh/apache/superset/pull/21982/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?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] villebro merged pull request #21982: chore: bubble up more db error messages
Posted by GitBox <gi...@apache.org>.
villebro merged PR #21982:
URL: https://github.com/apache/superset/pull/21982
--
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] zhaoyongjie commented on a diff in pull request #21982: chore: bubble up more db error messages
Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #21982:
URL: https://github.com/apache/superset/pull/21982#discussion_r1009543614
##########
superset/db_engine_specs/trino.py:
##########
@@ -220,3 +221,12 @@ def update_params_from_encrypted_extra(
except json.JSONDecodeError as ex:
logger.error(ex, exc_info=True)
raise ex
+
+ @classmethod
+ def get_dbapi_exception_mapping(cls) -> Dict[Type[Exception], Type[Exception]]:
+ # pylint: disable=import-error,import-outside-toplevel
+ from requests import exceptions as requests_exceptions
+
+ return {
+ requests_exceptions.ConnectionError: SupersetDBAPIDisconnectionError,
Review Comment:
There is a suggestion but it's not related to this PR. the `SupersetDBAPIDisconnectionError` might be an ambiguous naming here. the [ConnectionError](https://github.com/psf/requests/blob/1e62a3ec18e19f85ddae03b4cbbdf0b4c62834c0/requests/exceptions.py#L49) is a generic exception for connection-related issues rather than a specific error for *disconnection*, so I think we might change it to `SupersetDBAPIConnectionError`.
--
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