Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions src/databricks/sql/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ def execute(
self,
operation: str,
parameters: Optional[TParameterCollection] = None,
enforceEmbeddedSchema=False,
Copy link
Collaborator

@jackyhu-db jackyhu-db Feb 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you rename it to enforce_embedded_schema_correctness to be consistent with the meaning of the thrift API. "enforce schema" is different with "enforce schema with correctness". And please use snake case which is python style.

) -> "Cursor":
"""
Execute a query and wait for execution to complete.
Expand Down Expand Up @@ -801,6 +802,7 @@ def execute(
use_cloud_fetch=self.connection.use_cloud_fetch,
parameters=prepared_params,
async_op=False,
enforceEmbeddedSchema=enforceEmbeddedSchema,
)
self.active_result_set = ResultSet(
self.connection,
Expand All @@ -822,6 +824,7 @@ def execute_async(
self,
operation: str,
parameters: Optional[TParameterCollection] = None,
enforceEmbeddedSchema=False,
) -> "Cursor":
"""

Expand Down Expand Up @@ -862,6 +865,7 @@ def execute_async(
use_cloud_fetch=self.connection.use_cloud_fetch,
parameters=prepared_params,
async_op=True,
enforceEmbeddedSchema=enforceEmbeddedSchema,
)

return self
Expand Down
2 changes: 2 additions & 0 deletions src/databricks/sql/thrift_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,7 @@ def execute_command(
use_cloud_fetch=True,
parameters=[],
async_op=False,
enforceEmbeddedSchema=False,
):
assert session_handle is not None

Expand Down Expand Up @@ -910,6 +911,7 @@ def execute_command(
},
useArrowNativeTypes=spark_arrow_types,
parameters=parameters,
enforceEmbeddedSchemaCorrectness=enforceEmbeddedSchema,
)
resp = self.make_request(self._client.ExecuteStatement, req)

Expand Down
Loading