Skip to content

SEA parameters fix: pass params as ttypes.TSparkParameter to re-use existing parameter processing #612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: sea-migration
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/databricks/sql/backend/sea/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
ResultCompression,
WaitTimeout,
)
from databricks.sql.thrift_api.TCLIService import ttypes

if TYPE_CHECKING:
from databricks.sql.client import Cursor
Expand Down Expand Up @@ -402,7 +403,7 @@ def execute_command(
lz4_compression: bool,
cursor: "Cursor",
use_cloud_fetch: bool,
parameters: List[Dict[str, Any]],
parameters: List[ttypes.TSparkParameter],
async_op: bool,
enforce_embedded_schema_correctness: bool,
) -> Union["ResultSet", None]:
Expand Down Expand Up @@ -436,9 +437,9 @@ def execute_command(
for param in parameters:
sea_parameters.append(
StatementParameter(
name=param["name"],
value=param["value"],
type=param["type"] if "type" in param else None,
name=param.name,
value=param.value,
type=param.type,
)
)

Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_sea_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
_filter_session_configuration,
)
from databricks.sql.backend.types import SessionId, CommandId, CommandState, BackendType
from databricks.sql.thrift_api.TCLIService import ttypes
from databricks.sql.types import SSLOptions
from databricks.sql.auth.authenticators import AuthProvider
from databricks.sql.exc import (
Expand Down Expand Up @@ -354,7 +355,7 @@ def test_command_execution_advanced(
"status": {"state": "SUCCEEDED"},
}
mock_http_client._make_request.return_value = execute_response
param = {"name": "param1", "value": "value1", "type": "STRING"}
param = ttypes.TSparkParameter(name="param1", value="value1", type="STRING")

with patch.object(sea_client, "get_execution_result"):
sea_client.execute_command(
Expand Down
Loading