eschutho opened a new pull request, #41945: URL: https://github.com/apache/superset/pull/41945
### SUMMARY Databricks catalog/schema permission errors (e.g. `[INSUFFICIENT_PERMISSIONS] Insufficient privileges: User does not have USE CATALOG on Catalog 'foo'. SQLSTATE: 42501.`) were classified as `SupersetErrorType.GENERIC_DB_ENGINE_ERROR` and always returned to the client as HTTP 500, even though this is a customer-side permission misconfiguration, not a server error. Two changes were needed to fix this end-to-end: - `DatabricksDynamicBaseEngineSpec.extract_errors` (`superset/db_engine_specs/databricks.py`) now detects the `SQLSTATE: 42501` / `[INSUFFICIENT_PERMISSIONS]` pattern and classifies it as `SupersetErrorType.CONNECTION_DATABASE_PERMISSIONS_ERROR` at `ErrorLevel.WARNING`, instead of falling through to the generic catch-all at `ErrorLevel.ERROR`. - `SynchronousSqlJsonExecutor.execute` (`superset/sqllab/sql_json_executer.py`) previously raised `SupersetErrorsException` with no `status`, which always inherits the default 500 regardless of the contained errors' `level`. It now derives the status from the aggregate error level (all `WARNING` -> 400, any `ERROR` -> 500), mirroring the existing pattern in `commands/report/execute.py`. This is a shared code path used by every DB engine's rich-error responses; today every engine's `extract_errors` only emits `ERROR` level here, so this is a no-op for all engines except the new Databricks `WARNING` case above. ### TESTING INSTRUCTIONS - `pytest tests/unit_tests/db_engine_specs/test_databricks.py` — includes a new regression test asserting the SQLSTATE 42501 message yields `CONNECTION_DATABASE_PERMISSIONS_ERROR` at `ErrorLevel.WARNING`. - `pytest tests/unit_tests/sqllab/test_sql_json_executer.py` — new test file covering an all-`WARNING` errors list resulting in HTTP 400, and an `ERROR`/mixed-level list still resulting in HTTP 500. ### ADDITIONAL INFORMATION - [ ] 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
