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):
775
775
assert "Cancel query failed; no running query" in str (cancel_error .value )
776
776
777
777
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
+
778
790
def test_session_properties (run_trino ):
779
791
_ , host , port = run_trino
780
792
Original file line number Diff line number Diff line change @@ -567,7 +567,9 @@ def cancel(self):
567
567
self ._query .cancel ()
568
568
569
569
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.
571
573
572
574
573
575
Date = datetime .date
You can’t perform that action at this time.
0 commit comments