Skip to content

Commit 153d346

Browse files
committed
check types fix
Signed-off-by: Sai Shree Pradhan <saishree.pradhan@databricks.com>
1 parent 1b9a2b8 commit 153d346

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/databricks/sql/backend/types.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ def __init__(
282282
operation_type: Optional[int] = None,
283283
has_result_set: bool = False,
284284
modified_row_count: Optional[int] = None,
285-
statement_type: Optional[StatementType] = None,
286285
):
287286
"""
288287
Initialize a CommandId.
@@ -302,7 +301,7 @@ def __init__(
302301
self.operation_type = operation_type
303302
self.has_result_set = has_result_set
304303
self.modified_row_count = modified_row_count
305-
self._statement_type = statement_type
304+
self._statement_type = StatementType.NONE
306305

307306
def __str__(self) -> str:
308307
"""
@@ -421,7 +420,7 @@ def set_statement_type(self, statement_type: StatementType):
421420
self._statement_type = statement_type
422421

423422
@property
424-
def statement_type(self) -> Optional[StatementType]:
423+
def statement_type(self) -> StatementType:
425424
"""
426425
Get the statement type for this command.
427426
"""

tests/unit/test_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ def test_arraysize_buffer_size_passthrough(
189189
def test_closing_result_set_with_closed_connection_soft_closes_commands(self):
190190
mock_connection = Mock()
191191
mock_backend = Mock()
192+
mock_results = Mock()
192193
mock_backend.fetch_results.return_value = (Mock(), False, 0)
193194

194195
result_set = ThriftResultSet(
@@ -223,7 +224,9 @@ def test_closing_result_set_hard_closes_commands(self):
223224

224225
mock_thrift_backend.fetch_results.return_value = (Mock(), False, 0)
225226
result_set = ThriftResultSet(
226-
mock_connection, mock_results_response, mock_thrift_backend, session_id_hex=Mock())
227+
mock_connection, mock_results_response, mock_thrift_backend, session_id_hex=Mock()
228+
)
229+
result_set.results = mock_results
227230

228231
result_set.close()
229232

0 commit comments

Comments
 (0)