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
Post request to application causes a connection to local trino server
Connection makes a simple query (select * from tpch.sf1.nation) using sqlalchemy
Data rows returned and logged
Code:
`
engine = create_engine("trino://jon@localhost:8080/system")
conn = engine.connect()
result = conn.execute(text("select 1 as x")).fetchall()
for row in result:
logger.debug(row)
`
Actual behavior
Infinite loop of code requests calling "select version()" hit the local trino server, and python goes into an infinite loop:
(Note, this is one of several thousand, this never stops)
DBMS: Run a local docker container using trinodb/trino:latest
OS: WIndows 11
Python App: Python 3.10 or 3.12 (attempted using both)
Python Libraries:
trino==0.334.0
sqlalchemy==2.0.38
Using the above code, attempt to call your local docker trino. Any query fails - it never gets to the actual query.
Log output
The issue is the select version call in dialect.py: def _get_server_version_info(cls, connection: Connection) -> Any: def get_server_version_info(_): query = "SELECT version()" try: res = connection.execute(sql.text(query)) version = res.scalar() return tuple([version]) except exc.ProgrammingError as e: logger.debug(f"Failed to get server version: {e.orig.message}") return None
When I replace this with "return 475", all behavior is now as expected.
Operating System
Windows 11
Trino Python client version
0.334.0
Trino Server version
475
Python version
3.12.9
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Expected behavior
Code:
`
`
Actual behavior
Infinite loop of code requests calling "select version()" hit the local trino server, and python goes into an infinite loop:
(Note, this is one of several thousand, this never stops)
INFO 2025-05-21 15:58:51,240 trino.client 1013 - failed after 1 attempts
DEBUG 2025-05-21 15:58:51,243 urllib3.connectionpool 241 - Starting new HTTP connection (1269): localhost:8080
DEBUG 2025-05-21 15:58:51,255 urllib3.connectionpool 544 - http://localhost:8080 "POST /v1/statement HTTP/1.1" 200 351
DEBUG 2025-05-21 15:58:51,261 urllib3.connectionpool 544 - http://localhost:8080 "GET /v1/statement/queued/20250521_205902_04901_q83nv/ya189522748922861480aa59bd1ca7af2d04dc2fc/1 HTTP/1.1" 200 351
DEBUG 2025-05-21 15:58:51,268 urllib3.connectionpool 544 - http://localhost:8080 "GET /v1/statement/queued/20250521_205902_04901_q83nv/yae1ef533103b0d4dfe33f7c45c07325f4aa00b79/2 HTTP/1.1" 200 359
DEBUG 2025-05-21 15:58:51,276 urllib3.connectionpool 544 - http://localhost:8080 "GET /v1/statement/executing/20250521_205902_04901_q83nv/y201189cbc98d1a1f97104f718b9c6372baf9e43f/0 HTTP/1.1" 200 558
DEBUG 2025-05-21 15:58:51,284 urllib3.connectionpool 544 - http://localhost:8080 "GET /v1/statement/executing/20250521_205902_04901_q83nv/ya857eae45b999e5c9ab9fa64ff14b3a9e8a736a7/1 HTTP/1.1" 200 479
Steps To Reproduce
DBMS: Run a local docker container using trinodb/trino:latest
OS: WIndows 11
Python App: Python 3.10 or 3.12 (attempted using both)
Python Libraries:
trino==0.334.0
sqlalchemy==2.0.38
Using the above code, attempt to call your local docker trino. Any query fails - it never gets to the actual query.
Log output
The issue is the select version call in dialect.py:
def _get_server_version_info(cls, connection: Connection) -> Any: def get_server_version_info(_): query = "SELECT version()" try: res = connection.execute(sql.text(query)) version = res.scalar() return tuple([version]) except exc.ProgrammingError as e: logger.debug(f"Failed to get server version: {e.orig.message}") return None
When I replace this with "return 475", all behavior is now as expected.
Operating System
Windows 11
Trino Python client version
0.334.0
Trino Server version
475
Python version
3.12.9
Are you willing to submit PR?
The text was updated successfully, but these errors were encountered: