You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "betodealmeida (via GitHub)" <gi...@apache.org> on 2025/05/29 15:40:57 UTC
[PR] chore: make DB syntax erros 400 [superset]
betodealmeida opened a new pull request, #33619:
URL: https://github.com/apache/superset/pull/33619
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
When we fail to connect to a database because of custom DB errors we should return a 400 (since the errors are coming from the DB Superset it not doing anything wrong).
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] chore: make DB syntax errors 400 [superset]
Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on PR #33619:
URL: https://github.com/apache/superset/pull/33619#issuecomment-2919797286
Based on your review schedule, I'll hold off on reviewing this PR until it's marked as ready for review. If you'd like me to take a look now, comment `/korbit-review`.
> Your admin can change your review schedule in the [Korbit Console](https://app.korbit.ai/settings)
[](8361a91c-1a21-4339-8fcd-46053e435720)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] chore: make DB syntax errors 400 [superset]
Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #33619:
URL: https://github.com/apache/superset/pull/33619#discussion_r2114511766
##########
superset/commands/database/validate.py:
##########
@@ -125,7 +125,7 @@ def run(self) -> None:
"database": url.database,
}
errors = database.db_engine_spec.extract_errors(ex, context)
- raise DatabaseTestConnectionFailedError(errors) from ex
+ raise DatabaseTestConnectionFailedError(errors, status=400) from ex
Review Comment:
### Incorrect Error Status Code Classification <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The code universally applies a 400 status code to all database connection errors, but not all database connection errors are client-side errors (400).
###### Why this matters
Some database connection errors could be server-side issues (e.g., database server down, network issues) which should return 500 status codes. This could mislead clients about the nature of the error and cause incorrect error handling.
###### Suggested change ∙ *Feature Preview*
Add logic to differentiate between client-side and server-side errors. For example:
```python
errors = database.db_engine_spec.extract_errors(ex, context)
status = 400 if database.db_engine_spec.is_syntax_error(ex) else 500
raise DatabaseTestConnectionFailedError(errors, status=status) from ex
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/561e1991-ae97-4184-8fe6-18a01b161910/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/561e1991-ae97-4184-8fe6-18a01b161910?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/561e1991-ae97-4184-8fe6-18a01b161910?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/561e1991-ae97-4184-8fe6-18a01b161910?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/561e1991-ae97-4184-8fe6-18a01b161910)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:00fe8e1c-2695-4d52-bf0c-b51278fcee0e -->
[](00fe8e1c-2695-4d52-bf0c-b51278fcee0e)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] chore: make DB syntax errors 400 [superset]
Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida merged PR #33619:
URL: https://github.com/apache/superset/pull/33619
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org