trinodb / trino-python-client

Python client for Trino
Apache License 2.0
327 stars 163 forks source link

Closing a newly-created cursor throws #428

Closed batterseapower closed 9 months ago

batterseapower commented 10 months ago

Expected behavior

When you do this:

conn = trino.dbapi.connect(...)
cur = conn.cursor()
cur.close()

The close should succeed.

Actual behavior

The close actually fails:

trino.exceptions.OperationalError: Cancel query failed; no running query

Steps To Reproduce

conn = trino.dbapi.connect(...)
cur = conn.cursor()
cur.close()

Log output

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../python3.10/site-packages/trino/dbapi.py", line 709, in close
    self.cancel()
  File ".../python3.10/site-packages/trino/dbapi.py", line 703, in cancel
    raise trino.exceptions.OperationalError(
trino.exceptions.OperationalError: Cancel query failed; no running query

Operating System

CentOS 8

Trino Python client version

0.327.0

Trino Server version

406

Python version

3.10.8

Are you willing to submit PR?

hashhar commented 9 months ago

Seems that it would be fixed by https://github.com/trinodb/trino-python-client/pull/405