File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from enum import auto
2- from strenum import StrEnum
2+ from strenum import LowercaseStrEnum
33
44from .region import Region
55from .runtime import Runtime
1414MAX_MESSAGE_SIZE : int = 100 * 2 ** 20 # 100MiB
1515
1616
17- class ExecutionState (StrEnum ):
17+ class ExecutionState (LowercaseStrEnum ):
1818 IDLE = auto ()
1919 "Not executing any operation."
2020
@@ -40,21 +40,21 @@ def is_terminal_state(self):
4040 return self in (ExecutionState .COMPLETED , ExecutionState .FAILED )
4141
4242
43- class RequestKind (StrEnum ):
43+ class RequestKind (LowercaseStrEnum ):
4444 EXECUTE_SQL = auto ()
4545 RETRIEVE_RESULTS = auto ()
4646
4747
48- class EventKind (StrEnum ):
48+ class EventKind (LowercaseStrEnum ):
4949 STATE_UPDATED = auto ()
5050 EXECUTION_RESULT = auto ()
5151 ERROR = auto ()
5252
5353
54- class ResultsFormat (StrEnum ):
54+ class ResultsFormat (LowercaseStrEnum ):
5555 JSON = auto ()
5656 ARROW = auto ()
5757
5858
59- class DataCompression (StrEnum ):
59+ class DataCompression (LowercaseStrEnum ):
6060 BROTLI = auto ()
Original file line number Diff line number Diff line change @@ -77,8 +77,18 @@ def fetchmany(self, size: int = None):
7777 def fetchall (self ):
7878 return self .__get_results ()[self .__current_row :]
7979
80+ def close (self ):
81+ """Close the cursor."""
82+ pass
83+
8084 def __iter__ (self ):
8185 return self
8286
8387 def __next__ (self ):
8488 raise StopIteration
89+
90+ def __enter__ (self ):
91+ return self
92+
93+ def __exit__ (self , exc_type , exc_val , exc_tb ):
94+ self .close ()
You can’t perform that action at this time.
0 commit comments