Skip to content

Commit a56fb03

Browse files
consequent changes
Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
1 parent e3a78ff commit a56fb03

File tree

3 files changed

+5
-20
lines changed

3 files changed

+5
-20
lines changed

src/databricks/sql/client.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -335,15 +335,8 @@ def get_session_id(self):
335335
@staticmethod
336336
def get_protocol_version(openSessionResp):
337337
"""
338-
Since the sessionHandle will sometimes have a serverProtocolVersion, it takes
339-
precedence over the serverProtocolVersion defined in the OpenSessionResponse.
338+
Return the serverProtocolVersion from the OpenSessionResponse.
340339
"""
341-
if (
342-
openSessionResp.sessionHandle
343-
and hasattr(openSessionResp.sessionHandle, "serverProtocolVersion")
344-
and openSessionResp.sessionHandle.serverProtocolVersion
345-
):
346-
return openSessionResp.sessionHandle.serverProtocolVersion
347340
return openSessionResp.serverProtocolVersion
348341

349342
@staticmethod
@@ -754,7 +747,6 @@ def execute(
754747
self,
755748
operation: str,
756749
parameters: Optional[TParameterCollection] = None,
757-
enforce_embedded_schema_correctness=False,
758750
) -> "Cursor":
759751
"""
760752
Execute a query and wait for execution to complete.
@@ -819,7 +811,6 @@ def execute(
819811
use_cloud_fetch=self.connection.use_cloud_fetch,
820812
parameters=prepared_params,
821813
async_op=False,
822-
enforce_embedded_schema_correctness=enforce_embedded_schema_correctness,
823814
)
824815
self.active_result_set = ResultSet(
825816
self.connection,
@@ -841,7 +832,6 @@ def execute_async(
841832
self,
842833
operation: str,
843834
parameters: Optional[TParameterCollection] = None,
844-
enforce_embedded_schema_correctness=False,
845835
) -> "Cursor":
846836
"""
847837
@@ -882,7 +872,6 @@ def execute_async(
882872
use_cloud_fetch=self.connection.use_cloud_fetch,
883873
parameters=prepared_params,
884874
async_op=True,
885-
enforce_embedded_schema_correctness=enforce_embedded_schema_correctness,
886875
)
887876

888877
return self

src/databricks/sql/thrift_backend.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,6 @@ def execute_command(
884884
use_cloud_fetch=True,
885885
parameters=[],
886886
async_op=False,
887-
enforce_embedded_schema_correctness=False,
888887
):
889888
assert session_handle is not None
890889

@@ -916,7 +915,6 @@ def execute_command(
916915
},
917916
useArrowNativeTypes=spark_arrow_types,
918917
parameters=parameters,
919-
enforceEmbeddedSchemaCorrectness=enforce_embedded_schema_correctness,
920918
)
921919
resp = self.make_request(self._client.ExecuteStatement, req)
922920

tests/unit/test_parameters.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,15 @@ class TestSessionHandleChecks(object):
4242
(
4343
TOpenSessionResp(
4444
serverProtocolVersion=ttypes.TProtocolVersion.SPARK_CLI_SERVICE_PROTOCOL_V7,
45-
sessionHandle=TSessionHandle(1, None),
45+
sessionHandle=TSessionHandle(1),
4646
),
4747
ttypes.TProtocolVersion.SPARK_CLI_SERVICE_PROTOCOL_V7,
4848
),
49-
# Ensure that protocol version inside sessionhandle takes precedence.
49+
# This test no longer tests serverProtocolVersion precedence since TSessionHandle was changed
5050
(
5151
TOpenSessionResp(
52-
serverProtocolVersion=ttypes.TProtocolVersion.SPARK_CLI_SERVICE_PROTOCOL_V7,
53-
sessionHandle=TSessionHandle(
54-
1, ttypes.TProtocolVersion.SPARK_CLI_SERVICE_PROTOCOL_V8
55-
),
52+
serverProtocolVersion=ttypes.TProtocolVersion.SPARK_CLI_SERVICE_PROTOCOL_V8,
53+
sessionHandle=TSessionHandle(1),
5654
),
5755
ttypes.TProtocolVersion.SPARK_CLI_SERVICE_PROTOCOL_V8,
5856
),

0 commit comments

Comments
 (0)