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

chore: bubble up more db error messages #21982

Merged
merged 2 commits into from
Nov 1, 2022

Conversation

villebro
Copy link
Member

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.

AFTER

When trying to Explore a dataset that has an error, the toast now shows the error message:
image

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

BEFORE

On Explore, a generic uninformative error was toasted:
image

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:
image

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

@codecov
Copy link

codecov bot commented Oct 31, 2022

Codecov Report

Merging #21982 (4ac5cc2) into master (66f166b) will decrease coverage by 11.45%.
The diff coverage is 61.03%.

❗ Current head 4ac5cc2 differs from pull request most recent head c911b03. Consider uploading reports for the commit c911b03 to get more accurate results

@@             Coverage Diff             @@
##           master   #21982       +/-   ##
===========================================
- Coverage   66.92%   55.47%   -11.46%     
===========================================
  Files        1807     1808        +1     
  Lines       69238    69309       +71     
  Branches     7407     7407               
===========================================
- Hits        46338    38446     -7892     
- Misses      20991    28954     +7963     
  Partials     1909     1909               
Flag Coverage Δ
hive ?
mysql ?
presto 52.80% <33.82%> (-0.03%) ⬇️
python 57.68% <60.29%> (-23.74%) ⬇️
sqlite ?
unit 51.15% <58.08%> (+0.06%) ⬆️

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

Impacted Files Coverage Δ
...et-ui-core/src/connection/callApi/parseResponse.ts 100.00% <ø> (ø)
...-frontend/src/components/FilterableTable/index.tsx 72.67% <ø> (ø)
superset-frontend/src/explore/ExplorePage.tsx 0.00% <0.00%> (ø)
...uperset-frontend/src/utils/getClientErrorObject.ts 58.53% <ø> (ø)
superset/db_engine_specs/base.py 74.25% <0.00%> (-15.45%) ⬇️
superset/views/core.py 34.69% <0.00%> (-41.37%) ⬇️
superset/reports/commands/execute.py 23.94% <12.50%> (-68.34%) ⬇️
superset/databases/api.py 52.30% <14.28%> (-42.68%) ⬇️
superset/models/core.py 78.93% <25.00%> (-10.86%) ⬇️
superset/explore/commands/get.py 65.30% <28.57%> (-25.23%) ⬇️
... and 316 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@zhaoyongjie zhaoyongjie self-requested a review October 31, 2022 14:13
Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

LGTM. leave an unrelated suggestion, we might do the naming in the separate PR.

superset/db_engine_specs/trino.py Outdated Show resolved Hide resolved
@villebro villebro merged commit dc73995 into apache:master Nov 1, 2022
@villebro villebro deleted the villebro/errormsg branch November 1, 2022 06:34
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 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/L 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants