You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upon upgrading to version 0.334.0 we started receiving the following error message when connecting via Trino using Python and SQLAlchemy:
HttpError("error 400: b'<html>\\r\\n<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>\\r\\n<body>\\r\\n<center><h1>400 Bad Request</h1></center>\\r\\n<center>The plain HTTP request was sent to HTTPS port</center>\\r\\n</body>\\r\\n</html>\\r\\n'")
We tested that the issue does not exist in versions 0.329 or 0.333.
I cannot find any info on how to use HTTPS requests other than by setting the port to 443.
Expected behaviour: connect to Trino as before.
PS: why doesn't this template have a "Summary" tab?
Actual behavior
A connection attempt to Trino via Python and SQLAlchemy trigger the error message noted above. Reproducing here:
HttpError("error 400: b'<html>\\r\\n<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>\\r\\n<body>\\r\\n<center><h1>400 Bad Request</h1></center>\\r\\n<center>The plain HTTP request was sent to HTTPS port</center>\\r\\n</body>\\r\\n</html>\\r\\n'")
Steps To Reproduce
Steps:
Import Trino's URL function
Create a Trino URL with host, port, user, password and catalog fields
Create an SQLAlchemy engine
Run a query
Code:
from sqlalchemy import create_engine, text
from trino.sqlalchemy import URL as URL_trino
url = URL_trino(
host="server",
port=443,
user="username",
password="password",
catalog="catalog",
)
engine = create_engine(url)
with engine.connect() as con:
result = con.execute(text("select version()")).scalar()
print(result)
Log output
Here is a traceback:
Traceback (most recent call last):
File "C:\Users\rdimitrov\test.py", line 14, in <module>
result = con.execute(text("select version()")).scalar()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rdimitrov\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1416, in execute
return meth(
^^^^^
File "C:\Users\rdimitrov\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\sql\elements.py", line 523, in _execute_on_connection
return connection._execute_clauseelement(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rdimitrov\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1638, in _execute_clauseelement
ret = self._execute_context(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rdimitrov\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1843, in _execute_context
return self._exec_single_context(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rdimitrov\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1983, in _exec_single_context
self._handle_dbapi_exception(
File "C:\Users\rdimitrov\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 2355, in _handle_dbapi_exception
raise exc_info[1].with_traceback(exc_info[2])
File "C:\Users\rdimitrov\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1964, in _exec_single_context
self.dialect.do_execute(
File "C:\Users\rdimitrov\AppData\Local\Programs\Python\Python312\Lib\site-packages\trino\sqlalchemy\dialect.py", line 442, in do_execute
cursor.execute(statement, parameters)
File "C:\Users\rdimitrov\AppData\Local\Programs\Python\Python312\Lib\site-packages\trino\dbapi.py", line 629, in execute
self._iterator = iter(self._query.execute())
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rdimitrov\AppData\Local\Programs\Python\Python312\Lib\site-packages\trino\client.py", line 886, in execute
status = self._request.process(response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rdimitrov\AppData\Local\Programs\Python\Python312\Lib\site-packages\trino\client.py", line 684, in process
self.raise_response_error(http_response)
File "C:\Users\rdimitrov\AppData\Local\Programs\Python\Python312\Lib\site-packages\trino\client.py", line 675, in raise_response_error
raise exceptions.HttpError(
trino.exceptions.HttpError: error 400: b'<html>\r\n<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n<center>The plain HTTP request was sent to HTTPS port</center>\r\n</body>\r\n</html>\r\n'
Operating System
Windows 10 Enterprise 22H2 OS Build: 19045.5737
Trino Python client version
0.334.0
Trino Server version
443-e.6
Python version
3.12.4
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered:
Expected behavior
Hi, all.
Upon upgrading to version 0.334.0 we started receiving the following error message when connecting via Trino using Python and SQLAlchemy:
We tested that the issue does not exist in versions 0.329 or 0.333.
I cannot find any info on how to use HTTPS requests other than by setting the port to 443.
Expected behaviour: connect to Trino as before.
PS: why doesn't this template have a "Summary" tab?
Actual behavior
A connection attempt to Trino via Python and SQLAlchemy trigger the error message noted above. Reproducing here:
Steps To Reproduce
Steps:
Code:
Log output
Here is a traceback:
Operating System
Windows 10 Enterprise 22H2 OS Build: 19045.5737
Trino Python client version
0.334.0
Trino Server version
443-e.6
Python version
3.12.4
Are you willing to submit PR?
The text was updated successfully, but these errors were encountered: