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

fix: better handle datasource exceptions #13578

Merged
merged 7 commits into from
Mar 15, 2021

Conversation

dpgaspar
Copy link
Member

@dpgaspar dpgaspar commented Mar 11, 2021

SUMMARY

Fixes explore and dashboard superset API endpoints so that they can more gracefully handle exceptions from the engines. A more special case is by using the DB_CONNECTION_MUTATOR and raising from there.

Previously these endpoint would crash with HTTP 500

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

@pull-request-size pull-request-size bot added size/M and removed size/S labels Mar 12, 2021
@dpgaspar dpgaspar marked this pull request as ready for review March 12, 2021 11:38
@dpgaspar dpgaspar changed the title fix: handle datasource injected security exception fix: better handle datasource exceptions Mar 12, 2021
@codecov
Copy link

codecov bot commented Mar 12, 2021

Codecov Report

Merging #13578 (8abbacb) into master (5fca19d) will decrease coverage by 6.47%.
The diff coverage is 56.79%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13578      +/-   ##
==========================================
- Coverage   77.53%   71.06%   -6.48%     
==========================================
  Files         904      828      -76     
  Lines       45986    41460    -4526     
  Branches     5552     4307    -1245     
==========================================
- Hits        35657    29462    -6195     
- Misses      10195    11998    +1803     
+ Partials      134        0     -134     
Flag Coverage Δ
cypress 56.73% <25.58%> (-0.47%) ⬇️
hive ?
javascript ?
mysql 80.37% <74.36%> (-0.09%) ⬇️
postgres 80.42% <75.81%> (-0.07%) ⬇️
presto 80.10% <75.81%> (-0.07%) ⬇️
python 80.66% <76.17%> (-0.34%) ⬇️
sqlite 80.03% <74.00%> (-0.09%) ⬇️

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

Impacted Files Coverage Δ
...end/src/SqlLab/components/TemplateParamsEditor.tsx 5.55% <0.00%> (ø)
...controls/DndColumnSelectControl/DndSelectLabel.tsx 0.00% <0.00%> (-38.89%) ⬇️
...ents/controls/FilterControl/AdhocFilterControl.jsx 44.00% <ø> (-16.00%) ⬇️
.../controls/FilterControl/AdhocFilterEditPopover.jsx 10.00% <ø> (-48.00%) ⬇️
...Control/AdhocFilterEditPopoverSimpleTabContent.jsx 3.33% <ø> (-71.51%) ⬇️
...terControl/AdhocFilterEditPopoverSqlTabContent.jsx 6.66% <ø> (-56.67%) ⬇️
...nents/controls/FilterControl/AdhocFilterOption.jsx 100.00% <ø> (ø)
.../controls/MetricControl/AdhocMetricEditPopover.jsx 77.09% <ø> (-2.45%) ⬇️
...nents/controls/MetricControl/AdhocMetricOption.jsx 100.00% <ø> (ø)
...ponents/controls/MetricControl/AggregateOption.jsx 40.00% <ø> (ø)
... and 532 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 5fca19d...2a8a5e5. Read the comment docs.

@dpgaspar dpgaspar requested a review from villebro March 12, 2021 21:08
Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

Small comment

superset/databases/commands/update.py Show resolved Hide resolved
@dpgaspar dpgaspar merged commit 1e88408 into apache:master Mar 15, 2021
@dpgaspar dpgaspar deleted the fix/unsafe-databases-ex branch March 15, 2021 22:46
henryyeh pushed a commit to preset-io/superset that referenced this pull request Mar 18, 2021
* fix: handle datasource injected security exception

* add tests

* fix error text on create update dbs

* fix lint

* revert create update message

* fix test

* add sqlalchemy exceptions

(cherry picked from commit 1e88408)
henryyeh pushed a commit to preset-io/superset that referenced this pull request Mar 22, 2021
* fix: handle datasource injected security exception

* add tests

* fix error text on create update dbs

* fix lint

* revert create update message

* fix test

* add sqlalchemy exceptions

(cherry picked from commit 1e88408)
allanco91 pushed a commit to allanco91/superset that referenced this pull request May 21, 2021
* fix: handle datasource injected security exception

* add tests

* fix error text on create update dbs

* fix lint

* revert create update message

* fix test

* add sqlalchemy exceptions
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.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/M 🚢 1.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants