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: Test connection before starting on create transaction #15100

Merged
merged 2 commits into from
Jun 14, 2021

Conversation

hughhhh
Copy link
Member

@hughhhh hughhhh commented Jun 10, 2021

SUMMARY

Small bug where on failure of db connection, service fails to rollback. To fix this i've put the db connection before running on create database

TESTING INSTRUCTIONS

  1. Goto Database Connection modal
  2. Enter bad sqlalchemy_uri
  3. See failure raise in toast
  4. Refresh page and make sure the db wasn't add to the list

ADDITIONAL INFORMATION

  • Has associated issue:
  • 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 Jun 10, 2021

Codecov Report

Merging #15100 (646a47f) into master (f8b270d) will decrease coverage by 0.14%.
The diff coverage is 85.24%.

❗ Current head 646a47f differs from pull request most recent head 05d310d. Consider uploading reports for the commit 05d310d to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15100      +/-   ##
==========================================
- Coverage   77.53%   77.38%   -0.15%     
==========================================
  Files         967      967              
  Lines       49740    49752      +12     
  Branches     6351     6351              
==========================================
- Hits        38565    38500      -65     
- Misses      10973    11050      +77     
  Partials      202      202              
Flag Coverage Δ
hive ?
mysql 81.71% <90.90%> (+<0.01%) ⬆️
postgres 81.73% <90.90%> (-0.01%) ⬇️
python 81.81% <90.90%> (-0.29%) ⬇️
sqlite 81.36% <68.18%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
superset-frontend/src/dashboard/actions/hydrate.js 1.72% <ø> (ø)
...nd/src/dashboard/containers/DashboardComponent.jsx 92.30% <ø> (ø)
...-frontend/src/dashboard/reducers/dashboardState.js 73.33% <0.00%> (ø)
...et-frontend/src/filters/components/Select/types.ts 100.00% <ø> (ø)
...t-frontend/src/dashboard/actions/dashboardState.js 28.65% <33.33%> (ø)
.../FilterBar/CascadeFilters/CascadePopover/index.tsx 61.76% <50.00%> (ø)
...board/components/nativeFilters/FilterBar/index.tsx 90.90% <83.33%> (ø)
superset/databases/commands/create.py 88.23% <83.33%> (-3.93%) ⬇️
...d/src/dashboard/components/gridComponents/Tabs.jsx 87.50% <88.88%> (ø)
superset/views/core.py 75.55% <88.88%> (+0.07%) ⬆️
... and 25 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 f8b270d...05d310d. Read the comment docs.

Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

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

LGTM, but I wonder if we should add db.session.rollback() to the except block in line 70 now?

@hughhhh hughhhh merged commit 143a1b0 into master Jun 14, 2021
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
)

* test connection before starting on create transaction

* Update create.py
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
)

* test connection before starting on create transaction

* Update create.py
@rusackas rusackas deleted the hugh/fix-db-oncreate branch January 30, 2023 19:21
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
)

* test connection before starting on create transaction

* Update create.py
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.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 size/S 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants