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: get or create db with an existing invalid URL #23737

Merged
merged 3 commits into from
Apr 20, 2023

Conversation

dpgaspar
Copy link
Member

SUMMARY

When an existing invalid URL on the examples database exists, updating or reseting the examples database connection fails with:

121, in make_url_safe
    raise DatabaseInvalidError()  # pylint: disable=raise-missing-from
superset.databases.commands.exceptions.DatabaseInvalidError: Database parameters are invalid.

With this fix the get_or_create_db can support the existing invalid URI and update it URI with a new valid URI

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

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 Apr 19, 2023

Codecov Report

Merging #23737 (a6e9791) into master (44557f5) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head a6e9791 differs from pull request most recent head 61f126d. Consider uploading reports for the commit 61f126d to get more accurate results

@@           Coverage Diff           @@
##           master   #23737   +/-   ##
=======================================
  Coverage   68.11%   68.11%           
=======================================
  Files        1922     1922           
  Lines       74102    74103    +1     
  Branches     8100     8100           
=======================================
+ Hits        50474    50476    +2     
+ Misses      21550    21549    -1     
  Partials     2078     2078           
Flag Coverage Δ
hive 53.25% <75.00%> (+0.05%) ⬆️
mysql 79.24% <100.00%> (+0.01%) ⬆️
postgres 79.31% <100.00%> (+<0.01%) ⬆️
presto 53.17% <75.00%> (+0.05%) ⬆️
python 83.16% <100.00%> (+<0.01%) ⬆️
sqlite 77.81% <100.00%> (+0.01%) ⬆️
unit 53.05% <50.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
superset/common/query_context_processor.py 89.38% <100.00%> (+0.81%) ⬆️
superset/models/core.py 90.16% <100.00%> (+0.43%) ⬆️

... and 5 files with indirect coverage changes

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

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.

LGTM

Comment on lines -891 to +892
except (ArgumentError, ValueError):
except DatabaseInvalidError:
Copy link
Member

Choose a reason for hiding this comment

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

I almost asked about why the old exceptions here aren't valid any more. To answer that question for other potential reviewers: we're already reraising all exceptions to DatabaseInvalidError here:

except Exception:
raise DatabaseInvalidError() # pylint: disable=raise-missing-from

@dpgaspar dpgaspar merged commit f80e738 into apache:master Apr 20, 2023
@dpgaspar dpgaspar deleted the fix/non-sqlalchemy-uri branch April 20, 2023 08:50
jinghua-qa pushed a commit to preset-io/superset that referenced this pull request Apr 20, 2023
sebastianliebscher pushed a commit to sebastianliebscher/superset that referenced this pull request Apr 28, 2023
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 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/S 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants