-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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: API endpoint to validate databases using separate parameters #14420
Conversation
"username": url.username, | ||
"database": url.database, | ||
} | ||
errors = database.db_engine_spec.extract_errors(ex, context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add logger.warning
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need, raising exceptions in the API get logged by the error handler:
superset/superset/views/base.py
Lines 350 to 361 in 21cf12a
# SIP-40 compatible error responses; make sure APIs raise | |
# SupersetErrorException or SupersetErrorsException | |
@superset_app.errorhandler(SupersetErrorException) | |
def show_superset_error(ex: SupersetErrorException) -> FlaskResponse: | |
logger.warning(ex) | |
return json_errors_response(errors=[ex.error], status=ex.status) | |
@superset_app.errorhandler(SupersetErrorsException) | |
def show_superset_errors(ex: SupersetErrorsException) -> FlaskResponse: | |
logger.warning(ex) | |
return json_errors_response(errors=ex.errors, status=ex.status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 comment and 🚢
a5ffd8a
to
6b9828f
Compare
Codecov Report
@@ Coverage Diff @@
## master #14420 +/- ##
==========================================
- Coverage 77.40% 77.38% -0.02%
==========================================
Files 958 959 +1
Lines 48326 48450 +124
Branches 5677 5680 +3
==========================================
+ Hits 37405 37493 +88
- Misses 10721 10757 +36
Partials 200 200
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
c5a9205
to
db8afac
Compare
@@ -630,7 +630,7 @@ def _try_json_readsha( # pylint: disable=unused-argument | |||
|
|||
# Default row limit for SQL Lab queries. Is overridden by setting a new limit in | |||
# the SQL Lab UI | |||
DEFAULT_SQLLAB_LIMIT = 1000 | |||
DEFAULT_SQLLAB_LIMIT = 10000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@betodealmeida any reason for the change from 1,000 to 10,000? We have had a number of employees mention that 10,000 overloads their local storage use and breaks Chrome and thus I'm unsure if the default of 10,000 makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, let me change the default back. Sorry for that!
…pache#14420) * feat: new endpoint for validating database parameters * Rebase * Remove broken tests
…pache#14420) * feat: new endpoint for validating database parameters * Rebase * Remove broken tests
…pache#14420) * feat: new endpoint for validating database parameters * Rebase * Remove broken tests
SUMMARY
This PR adds a new endpoint at
api/v1/database/validate_parameters
for validating separate parameters when adding/editing a database. With this flow, users can add databases by passing DB-specific parameters (username, password, host, port, etc.) instead of the full SQLAlchemy URI.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TEST PLAN
Added unit tests for the new command
ValidateDatabaseParametersCommand
, as well as the new API.ADDITIONAL INFORMATION