superset: Trino backend fails with Superset 3.0.0

Trino backend fails with the below error while running with Superset 3.0.0. The issue occurs in Preset as well.

Downgrading Superset to 2.1.0 version solves the issue.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/hovaesco/Desktop/repos/superset/.venv/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hovaesco/Desktop/repos/superset/.venv/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hovaesco/Desktop/repos/superset/.venv/lib/python3.11/site-packages/flask_appbuilder/security/decorators.py", line 95, in wraps
    return f(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hovaesco/Desktop/repos/superset/.venv/lib/python3.11/site-packages/superset/views/base_api.py", line 127, in wraps
    raise ex
  File "/Users/hovaesco/Desktop/repos/superset/.venv/lib/python3.11/site-packages/superset/views/base_api.py", line 121, in wraps
    duration, response = time_function(f, self, *args, **kwargs)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hovaesco/Desktop/repos/superset/.venv/lib/python3.11/site-packages/superset/utils/core.py", line 1526, in time_function
    response = func(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hovaesco/Desktop/repos/superset/.venv/lib/python3.11/site-packages/superset/views/base_api.py", line 93, in wraps
    return f(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hovaesco/Desktop/repos/superset/.venv/lib/python3.11/site-packages/superset/utils/log.py", line 255, in wrapper
    value = f(*args, **kwargs)
            ^^^^^^^^^^^^^^^^^^
  File "/Users/hovaesco/Desktop/repos/superset/.venv/lib/python3.11/site-packages/superset/sqllab/api.py", line 310, in execute_sql_query
    command_result: CommandResult = command.run()
                                    ^^^^^^^^^^^^^
  File "/Users/hovaesco/Desktop/repos/superset/.venv/lib/python3.11/site-packages/superset/sqllab/commands/execute.py", line 121, in run
    raise ex
  File "/Users/hovaesco/Desktop/repos/superset/.venv/lib/python3.11/site-packages/superset/sqllab/commands/execute.py", line 103, in run
    status = self._run_sql_json_exec_from_scratch()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hovaesco/Desktop/repos/superset/.venv/lib/python3.11/site-packages/superset/sqllab/commands/execute.py", line 161, in _run_sql_json_exec_from_scratch
    raise ex
  File "/Users/hovaesco/Desktop/repos/superset/.venv/lib/python3.11/site-packages/superset/sqllab/commands/execute.py", line 156, in _run_sql_json_exec_from_scratch
    return self._sql_json_executor.execute(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hovaesco/Desktop/repos/superset/.venv/lib/python3.11/site-packages/superset/sqllab/sql_json_executer.py", line 104, in execute
    raise SupersetGenericDBErrorException(
superset.exceptions.SupersetGenericDBErrorException: 'query_id'

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 24 (18 by maintainers)

Most upvoted comments

@giftig I’ve just tested and it works fine ! thank you for the fix

@giftig You’re right! That error is trino version issue. Now I’m fine after edit my version. Thanks for your help!

@devery59 try checking you’re using the recommended trino driver version. Your error complains that 'Cursor' object has no attribute 'query_id'", but it does have that attribute in 0.324.0, the version used by superset: https://github.com/trinodb/trino-python-client/blob/11dd0bc5b136e3f943712fd3c6f1f9ac8d4b0c37/trino/dbapi.py#L350

Hi @hovaesco, I’ve raised a new PR to reinstate the patch and add a small config fix for sqlite to resolve the issue you reported here, do you have time to try running with this change? If you’re overriding SQLALCHEMY_DATABASE_URI make sure you have the ?check_same_thread=false config I’ve added to the default; that should solve the problem.

https://github.com/apache/superset/pull/25680

@giftig it’s the same as you:

>>> import sqlite3
>>> sqlite3.version
'2.6.0'

I’m running on Mac (I haven’t been able to test on linux/k8s yet)

I can reproduce this on master. @giftig I will ping you on Slack to see if we can collab on fixing this quickly.