Skip to content

Commit 24c6152

Browse files
remove more irrelevant changes
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent ee9fa1c commit 24c6152

File tree

2 files changed

+132
-662
lines changed

2 files changed

+132
-662
lines changed

src/databricks/sql/backend/types.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
from dataclasses import dataclass
12
from enum import Enum
2-
from typing import Dict, Optional, Any
3+
from typing import Dict, List, Optional, Any, Tuple
34
import logging
45

56
from databricks.sql.backend.utils import guid_to_hex_id
@@ -80,6 +81,26 @@ def from_thrift_state(
8081
else:
8182
return None
8283

84+
@classmethod
85+
def from_sea_state(cls, state: str) -> Optional["CommandState"]:
86+
"""
87+
Map SEA state string to CommandState enum.
88+
Args:
89+
state: SEA state string
90+
Returns:
91+
CommandState: The corresponding CommandState enum value
92+
"""
93+
state_mapping = {
94+
"PENDING": cls.PENDING,
95+
"RUNNING": cls.RUNNING,
96+
"SUCCEEDED": cls.SUCCEEDED,
97+
"FAILED": cls.FAILED,
98+
"CLOSED": cls.CLOSED,
99+
"CANCELED": cls.CANCELLED,
100+
}
101+
102+
return state_mapping.get(state, None)
103+
83104

84105
class BackendType(Enum):
85106
"""
@@ -394,3 +415,19 @@ def to_hex_guid(self) -> str:
394415
return guid_to_hex_id(self.guid)
395416
else:
396417
return str(self.guid)
418+
419+
420+
@dataclass
421+
class ExecuteResponse:
422+
"""Response from executing a SQL command."""
423+
424+
command_id: CommandId
425+
status: CommandState
426+
description: Optional[
427+
List[Tuple[str, str, None, None, Optional[int], Optional[int], bool]]
428+
] = None
429+
has_more_rows: bool = False
430+
results_queue: Optional[Any] = None
431+
has_been_closed_server_side: bool = False
432+
lz4_compressed: bool = True
433+
is_staging_operation: bool = False

0 commit comments

Comments
 (0)