We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
connection engine connects successfully
engine = create_engine('trino://user:[email protected]:443/data') connection = engine.connect()
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'
Trino python client: trino 0.334.0 Trino cluster (version 472)
No response
macOS Sequoia Version 15.1
0.334.0
472
Python 3.13.2
The text was updated successfully, but these errors were encountered:
Hi @sharas2050, could you check if explicitly setting http_scheme to https solves your issue?
http_scheme
https
engine = create_engine( 'trino://user:[email protected]:443/data', connect_args = { "http_scheme": "https", } )
Sorry, something went wrong.
Hi, yes. Adding connection args solved the issue. Thanks
I think that TPC should automatically set the correct HTTP scheme if a port is explicitly provided. @hashhar WDYT? I can open PR for that
Port 443 is not guaranteed to be HTTPS. It's just a convention.
So we can auto-set schema to HTTPS for 443 and HTTP for 80 and leave empty for others BUT IF AND ONLY IF http_scheme was not explicitly provided.
Please go ahead @damian3031
Is this same issue as #557?
damian3031
Successfully merging a pull request may close this issue.
Expected behavior
connection engine connects successfully
Actual behavior
Following code snippet returns error
PRODUCES:
Traceback (most recent call last):
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?
The text was updated successfully, but these errors were encountered: