Skip to content

SQLAlchemy connection does not work after latest release #556

@sharas2050

Description

@sharas2050

Expected behavior

connection engine connects successfully

engine = create_engine('trino://user:[email protected]:443/data')
connection = engine.connect()

Actual behavior

Following code snippet returns error

engine = create_engine('trino://user:[email protected]:443/data')
connection = engine.connect()

rows = connection.execute(text("SELECT * FROM data.schema.table limit 5"))

print(rows.fetchall())

PRODUCES:
Traceback (most recent call last):

  File "/git/trino-python-client/main.py", line 19, in <module>
    rows = connection.execute(text("SELECT * FROM data.schema.table limit 5"))
  File "/Library/Caches/pypoetry/virtualenvs/trino-client-TtW9DZEh-py3.13/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1416, in execute
    return meth(
        self,
        distilled_parameters,
        execution_options or NO_OPTIONS,
    )
  File "/Library/Caches/pypoetry/virtualenvs/trino-client-TtW9DZEh-py3.13/lib/python3.13/site-packages/sqlalchemy/sql/elements.py", line 523, in _execute_on_connection
    return connection._execute_clauseelement(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        self, distilled_params, execution_options
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Library/Caches/pypoetry/virtualenvs/trino-client-TtW9DZEh-py3.13/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1638, in _execute_clauseelement
    ret = self._execute_context(
        dialect,
    ...<8 lines>...
        cache_hit=cache_hit,
    )
  File "/Library/Caches/pypoetry/virtualenvs/trino-client-TtW9DZEh-py3.13/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1843, in _execute_context
    return self._exec_single_context(
           ~~~~~~~~~~~~~~~~~~~~~~~~~^
        dialect, context, statement, parameters
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Library/Caches/pypoetry/virtualenvs/trino-client-TtW9DZEh-py3.13/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1983, in _exec_single_context
    self._handle_dbapi_exception(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        e, str_statement, effective_parameters, cursor, context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Library/Caches/pypoetry/virtualenvs/trino-client-TtW9DZEh-py3.13/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
    raise exc_info[1].with_traceback(exc_info[2])
  File "/Library/Caches/pypoetry/virtualenvs/trino-client-TtW9DZEh-py3.13/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1964, in _exec_single_context
    self.dialect.do_execute(
    ~~~~~~~~~~~~~~~~~~~~~~~^
        cursor, str_statement, effective_parameters, context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Library/Caches/pypoetry/virtualenvs/trino-client-TtW9DZEh-py3.13/lib/python3.13/site-packages/trino/sqlalchemy/dialect.py", line 442, in do_execute
    cursor.execute(statement, parameters)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Caches/pypoetry/virtualenvs/trino-client-TtW9DZEh-py3.13/lib/python3.13/site-packages/trino/dbapi.py", line 629, in execute
    self._iterator = iter(self._query.execute())
                          ~~~~~~~~~~~~~~~~~~~^^
  File "/Library/Caches/pypoetry/virtualenvs/trino-client-TtW9DZEh-py3.13/lib/python3.13/site-packages/trino/client.py", line 886, in execute
    status = self._request.process(response)
  File "/Library/Caches/pypoetry/virtualenvs/trino-client-TtW9DZEh-py3.13/lib/python3.13/site-packages/trino/client.py", line 684, in process
    self.raise_response_error(http_response)
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/Library/Caches/pypoetry/virtualenvs/trino-client-TtW9DZEh-py3.13/lib/python3.13/site-packages/trino/client.py", line 675, in raise_response_error
    raise exceptions.HttpError(
    ...<4 lines>...
    )
trino.exceptions.HttpError: error 404: b'404 page not found\n'

Steps To Reproduce

Trino python client:
trino 0.334.0
Trino cluster (version 472)

Log output

No response

Operating System

macOS Sequoia Version 15.1

Trino Python client version

0.334.0

Trino Server version

472

Python version

Python 3.13.2

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions