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: initial custom error messages for SQL Lab #12080

Merged
merged 1 commit into from
Dec 18, 2020

Conversation

betodealmeida
Copy link
Member

SUMMARY

This PR adds the exception SupersetGenericDBErrorException, so we can start showing custom errors in SQL Lab. I still need to replace calls to json_response_error with throwing the exception in many parts of the view, but it already works for some errors (see screenshots).

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screenshot_2020-12-16 Superset(1)
Screenshot_2020-12-16 Superset(2)

TEST PLAN

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@codecov-io
Copy link

codecov-io commented Dec 16, 2020

Codecov Report

Merging #12080 (0ea9c5b) into master (48fb8c0) will decrease coverage by 4.23%.
The diff coverage is 43.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12080      +/-   ##
==========================================
- Coverage   67.56%   63.32%   -4.24%     
==========================================
  Files         959      971      +12     
  Lines       47161    47959     +798     
  Branches     4613     4735     +122     
==========================================
- Hits        31864    30371    -1493     
- Misses      15185    17402    +2217     
- Partials      112      186      +74     
Flag Coverage Δ
cypress ?
javascript 62.05% <0.00%> (-0.63%) ⬇️
python 64.11% <75.00%> (-0.20%) ⬇️

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

Impacted Files Coverage Δ
...erset-frontend/src/SqlLab/components/ResultSet.tsx 66.82% <ø> (-0.16%) ⬇️
.../components/ErrorMessage/ParameterErrorMessage.tsx 0.00% <0.00%> (ø)
superset-frontend/src/setup/setupErrorMessages.ts 0.00% <0.00%> (-61.54%) ⬇️
superset/views/core.py 75.37% <44.44%> (-0.08%) ⬇️
superset/exceptions.py 96.61% <92.85%> (+4.61%) ⬆️
superset/views/base.py 75.21% <100.00%> (+0.84%) ⬆️
superset-frontend/src/SqlLab/App.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/explore/App.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/dashboard/App.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/setup/setupColors.js 0.00% <0.00%> (-100.00%) ⬇️
... and 229 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 48fb8c0...0ea9c5b. Read the comment docs.

@etr2460
Copy link
Member

etr2460 commented Dec 17, 2020

thanks for taking on this work! One question, how will this work for async queries? Or is that out of scope for now?

@betodealmeida
Copy link
Member Author

thanks for taking on this work! One question, how will this work for async queries? Or is that out of scope for now?

Yeah! My plan is to split the work into 3 parts:

  1. This PR
  2. Other sync errors
  3. Async errors

I haven't looked at the async part yet, from I'm assuming we'll have to serialize the exception?

@betodealmeida betodealmeida force-pushed the ch3979 branch 2 times, most recently from 9b77b06 to 4b5b49e Compare December 17, 2020 01:32
@betodealmeida betodealmeida marked this pull request as ready for review December 17, 2020 02:05
@etr2460
Copy link
Member

etr2460 commented Dec 17, 2020

yeah, i think we'll need to serialize it into the error_message column in the query table, then do some checks on the other side to see if we can parse it as a dict or not

Copy link
Member

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

a few comments

@betodealmeida betodealmeida force-pushed the ch3979 branch 2 times, most recently from 5fca8fb to ab209e8 Compare December 17, 2020 18:37
Copy link
Member

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

one nit, otherwise lgtm

superset/views/core.py Show resolved Hide resolved
@betodealmeida betodealmeida merged commit 6e7f276 into apache:master Dec 18, 2020
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.0.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 preset-io size/L 🚢 1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants