Skip to content

Commit ece7616

Browse files
add strong return type for execute_command
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent c0b989c commit ece7616

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/databricks/sql/backend/databricks_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def execute_command(
8383
parameters: List[ttypes.TSparkParameter],
8484
async_op: bool,
8585
enforce_embedded_schema_correctness: bool,
86-
) -> Any:
86+
) -> Optional[ExecuteResponse]:
8787
"""
8888
Executes a SQL command or query within the specified session.
8989

src/databricks/sql/backend/thrift_backend.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import time
66
import uuid
77
import threading
8-
from typing import List, Union, Any, TYPE_CHECKING
8+
from typing import List, Optional, Union, Any, TYPE_CHECKING
99

1010
if TYPE_CHECKING:
1111
from databricks.sql.client import Cursor
@@ -929,7 +929,7 @@ def execute_command(
929929
parameters=[],
930930
async_op=False,
931931
enforce_embedded_schema_correctness=False,
932-
):
932+
) -> Optional[ExecuteResponse]:
933933
thrift_handle = session_id.to_thrift_handle()
934934
if not thrift_handle:
935935
raise ValueError("Not a valid Thrift session ID")
@@ -974,6 +974,7 @@ def execute_command(
974974

975975
if async_op:
976976
self._handle_execute_response_async(resp, cursor)
977+
return None
977978
else:
978979
return self._handle_execute_response(resp, cursor)
979980

src/databricks/sql/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,8 @@ def execute(
783783
async_op=False,
784784
enforce_embedded_schema_correctness=enforce_embedded_schema_correctness,
785785
)
786+
assert execute_response is not None # async_op = False above
787+
786788
self.active_result_set = ResultSet(
787789
self.connection,
788790
execute_response,

0 commit comments

Comments
 (0)