File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -775,6 +775,18 @@ def test_cancel_query(trino_connection):
775775 assert "Cancel query failed; no running query" in str (cancel_error .value )
776776
777777
778+ def test_close_cursor (trino_connection ):
779+ cur = trino_connection .cursor ()
780+ cur .execute ("SELECT * FROM tpch.sf1.customer" )
781+ cur .fetchone ()
782+ cur .close () # would raise an exception if cancel fails
783+
784+ cur = trino_connection .cursor ()
785+ with pytest .raises (Exception ) as cancel_error :
786+ cur .close ()
787+ assert "Cancel query failed; no running query" in str (cancel_error .value )
788+
789+
778790def test_session_properties (run_trino ):
779791 _ , host , port = run_trino
780792
Original file line number Diff line number Diff line change @@ -567,7 +567,9 @@ def cancel(self):
567567 self ._query .cancel ()
568568
569569 def close (self ):
570- self ._connection .close ()
570+ self .cancel ()
571+ # TODO: Cancel not only the last query executed on this cursor
572+ # but also any other outstanding queries executed through this cursor.
571573
572574
573575Date = datetime .date
You can’t perform that action at this time.
0 commit comments