Manish-2023 opened a new issue, #33554:
URL: https://github.com/apache/superset/issues/33554

   ### Bug description
   
   Description:
   When running queries from SQL Lab against a Presto database connection, 
Superset returns a 401 Unauthorized error:
   ```
   Presto Error
   presto error: Unexpected status code 401
   b'Unauthorized'
   
   
   This may be triggered by:
   Issue 1002 - The database returned an unexpected error. 
   
   See less
   ```
   However, the same Presto connection works for creating datasets and charts
   
   
   ### Screenshots/recordings
   
   
![Image](https://github.com/user-attachments/assets/821fce6b-36bc-41ed-9d70-2cc8c8601bc3)
   
   
![Image](https://github.com/user-attachments/assets/6a9b65dd-95ff-45e6-813c-353028805ec7)
   
   ### Superset version
   
   4.1.2
   
   ### Python version
   
   3.10
   
   ### Node version
   
   16
   
   ### Browser
   
   Safari
   
   ### Additional context
   
   Environment:
   - Superset 4.1.1, 4.12 
   - Presto  0.289
   - Kubernetes deployment
   
   Logs
   ```
   2025-05-22 05:38:20,251:INFO:superset.commands.sql_lab.execute:Triggering 
query_id: 2
   
   2025-05-22 05:38:20,278:INFO:superset.sql_lab:Query 2: Executing 1 
statement(s)
   
   2025-05-22 05:38:20,278:INFO:superset.sql_lab:Query 2: Set query to 'running'
   
   2025-05-22 05:38:20,301:INFO:superset.sql_lab:Query 2: Running statement 1 
out of 1
   
   2025-05-22 05:38:20,340:INFO:pyhive.presto:SELECT
   
     *
   
   FROM "bank_demo"."bank2024-03-04"
   
   LIMIT 101
   
     warnings.warn(
   
   2025-05-22 
05:38:20,693:WARNING:superset.views.error_handling:SupersetErrorsException
   
   Traceback (most recent call last):
   
     File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1484, in 
full_dispatch_request
   
       rv = self.dispatch_request()
   
     File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1469, in 
dispatch_request
   
       return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
   
     File 
"/usr/local/lib/python3.10/site-packages/flask_appbuilder/security/decorators.py",
 line 95, in wraps
   
       return f(self, *args, **kwargs)
   
     File "/app/superset/views/base_api.py", line 119, in wraps
   
       duration, response = time_function(f, self, *args, **kwargs)
   
     File "/app/superset/utils/core.py", line 1364, in time_function
   
       response = func(*args, **kwargs)
   
     File "/app/superset/views/base_api.py", line 91, in wraps
   
       return f(self, *args, **kwargs)
   
     File "/app/superset/utils/log.py", line 303, in wrapper
   
       value = f(*args, **kwargs)
   
     File "/app/superset/sqllab/api.py", line 409, in execute_sql_query
   
       command_result: CommandResult = command.run()
   
     File "/app/superset/utils/decorators.py", line 266, in wrapped
   
       return on_error(ex)
   
     File "/app/superset/utils/decorators.py", line 236, in on_error
   
       raise ex
   
     File "/app/superset/utils/decorators.py", line 259, in wrapped
   
       result = func(*args, **kwargs)
   
     File "/app/superset/commands/sql_lab/execute.py", line 105, in run
   
       status = self._run_sql_json_exec_from_scratch()
   
     File "/app/superset/commands/sql_lab/execute.py", line 158, in 
_run_sql_json_exec_from_scratch
   
       return self._sql_json_executor.execute(
   
     File "/app/superset/sqllab/sql_json_executer.py", line 111, in execute
   
       raise SupersetErrorsException(
   
   superset.exceptions.SupersetErrorsException: [SupersetError(message="presto 
error: Unexpected status code 401\nb'Unauthorized'", 
error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 
'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, 
extra={'engine_name': 'Presto', 'issue_codes': [{'code': 1002, 'message': 
'Issue 1002 - The database returned an unexpected error.'}]})]
   ```
   Workarounds tried:
   - Disabling SQL validators for Presto
   ```
   configOverrides:
     superset_config.py: |
       # Override SQL_VALIDATORS_BY_ENGINE to disable validation for Presto
       SQL_VALIDATORS_BY_ENGINE = {
           "presto": None,
           "postgresql": "PostgreSQLValidator",
       }
   ```
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
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]

Reply via email to