Skip to content

Commit 241e934

Browse files
nithinkdbJesse
andauthored
[PECO-1083] Updated thrift files and added check for protocol version (#229)
* Updated thrift files and added check for protocol version Signed-off-by: nithinkdb <nithin.krishnamurthi@databricks.com> * Made error message more clear Signed-off-by: nithinkdb <nithin.krishnamurthi@databricks.com> * Changed name of fn Signed-off-by: nithinkdb <nithin.krishnamurthi@databricks.com> * Ran linter Signed-off-by: nithinkdb <nithin.krishnamurthi@databricks.com> * Update src/databricks/sql/client.py Co-authored-by: Jesse <jwhitehouse@airpost.net> --------- Signed-off-by: nithinkdb <nithin.krishnamurthi@databricks.com> Co-authored-by: Jesse <jwhitehouse@airpost.net>
1 parent 7c72cf4 commit 241e934

File tree

3 files changed

+3964
-324
lines changed

3 files changed

+3964
-324
lines changed

src/databricks/sql/client.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import requests
66
import json
77
import os
8+
from databricks.sql.thrift_api.TCLIService import ttypes
89

910
from databricks.sql import __version__
1011
from databricks.sql import *
@@ -225,6 +226,11 @@ def __del__(self):
225226
def get_session_id(self):
226227
return self.thrift_backend.handle_to_id(self._session_handle)
227228

229+
def get_session_protocol_version(self):
230+
return self.thrift_backend.extract_protocol_version_from_handle(
231+
self._session_handle
232+
)
233+
228234
def get_session_id_hex(self):
229235
return self.thrift_backend.handle_to_hex_id(self._session_handle)
230236

@@ -501,6 +507,13 @@ def execute(
501507
"""
502508
if parameters is None:
503509
parameters = []
510+
elif (
511+
self.connection.get_session_protocol_version()
512+
< ttypes.TProtocolVersion.SPARK_CLI_SERVICE_PROTOCOL_V8
513+
):
514+
raise Error(
515+
"Parameterized operations are not supported by this server. DBR 14.1 is required."
516+
)
504517
else:
505518
parameters = named_parameters_to_tsparkparams(parameters)
506519

0 commit comments

Comments
 (0)