Skip to content

Commit ccc3388

Browse files
Merge branch 'sea-migration' into sea-optimise-success
2 parents 5383fdb + dc1cb6d commit ccc3388

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

src/databricks/sql/backend/databricks_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def execute_command(
8282
parameters: List[ttypes.TSparkParameter],
8383
async_op: bool,
8484
enforce_embedded_schema_correctness: bool,
85+
row_limit: Optional[int] = None,
8586
) -> Union[ResultSet, None]:
8687
"""
8788
Executes a SQL command or query within the specified session.
@@ -100,6 +101,7 @@ def execute_command(
100101
parameters: List of parameters to bind to the query
101102
async_op: Whether to execute the command asynchronously
102103
enforce_embedded_schema_correctness: Whether to enforce schema correctness
104+
row_limit: Maximum number of rows in the response.
103105
104106
Returns:
105107
If async_op is False, returns a ResultSet object containing the

src/databricks/sql/backend/sea/backend.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
WaitTimeout,
1515
MetadataCommands,
1616
)
17+
from databricks.sql.thrift_api.TCLIService import ttypes
1718

1819
if TYPE_CHECKING:
1920
from databricks.sql.client import Cursor
@@ -424,7 +425,7 @@ def execute_command(
424425
lz4_compression: bool,
425426
cursor: Cursor,
426427
use_cloud_fetch: bool,
427-
parameters: List[Dict[str, Any]],
428+
parameters: List[ttypes.TSparkParameter],
428429
async_op: bool,
429430
enforce_embedded_schema_correctness: bool,
430431
row_limit: Optional[int] = None,
@@ -459,9 +460,11 @@ def execute_command(
459460
for param in parameters:
460461
sea_parameters.append(
461462
StatementParameter(
462-
name=param["name"],
463-
value=param["value"],
464-
type=param["type"] if "type" in param else None,
463+
name=param.name,
464+
value=(
465+
param.value.stringValue if param.value is not None else None
466+
),
467+
type=param.type,
465468
)
466469
)
467470

src/databricks/sql/backend/thrift_backend.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,6 @@ def __init__(
239239
def max_download_threads(self) -> int:
240240
return self._max_download_threads
241241

242-
@property
243-
def max_download_threads(self) -> int:
244-
return self._max_download_threads
245-
246242
# TODO: Move this bounding logic into DatabricksRetryPolicy for v3 (PECO-918)
247243
def _initialize_retry_args(self, kwargs):
248244
# Configure retries & timing: use user-settings or defaults, and bound

tests/unit/test_sea_backend.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
_filter_session_configuration,
1414
)
1515
from databricks.sql.backend.types import SessionId, CommandId, CommandState, BackendType
16+
from databricks.sql.parameters.native import IntegerParameter, TDbsqlParameter
17+
from databricks.sql.thrift_api.TCLIService import ttypes
1618
from databricks.sql.types import SSLOptions
1719
from databricks.sql.auth.authenticators import AuthProvider
1820
from databricks.sql.exc import (
@@ -352,7 +354,8 @@ def test_command_execution_advanced(
352354
"status": {"state": "SUCCEEDED"},
353355
}
354356
mock_http_client._make_request.return_value = execute_response
355-
param = {"name": "param1", "value": "value1", "type": "STRING"}
357+
dbsql_param = IntegerParameter(name="param1", value=1)
358+
param = dbsql_param.as_tspark_param(named=True)
356359

357360
with patch.object(sea_client, "_response_to_result_set"):
358361
sea_client.execute_command(
@@ -371,8 +374,8 @@ def test_command_execution_advanced(
371374
assert "parameters" in kwargs["data"]
372375
assert len(kwargs["data"]["parameters"]) == 1
373376
assert kwargs["data"]["parameters"][0]["name"] == "param1"
374-
assert kwargs["data"]["parameters"][0]["value"] == "value1"
375-
assert kwargs["data"]["parameters"][0]["type"] == "STRING"
377+
assert kwargs["data"]["parameters"][0]["value"] == "1"
378+
assert kwargs["data"]["parameters"][0]["type"] == "INT"
376379

377380
# Test execution failure
378381
mock_http_client.reset_mock()

0 commit comments

Comments
 (0)