Skip to content

Commit d7ab2fe

Browse files
Python connector changes for server-side Snowpark (#1964)
* Initial checkin for Phase 0 changes to the connector (#1963) * Appended the required DESCRIPTION.md change describing this diff * Removed the snippet from DESCRIPTION.md since our change isn't public
1 parent 1c6f1fe commit d7ab2fe

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/snowflake/connector/connection.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,7 @@ def cmd_query(
12871287
_update_current_object: bool = True,
12881288
_no_retry: bool = False,
12891289
timeout: int | None = None,
1290+
dataframe_ast: str | None = None,
12901291
) -> dict[str, Any]:
12911292
"""Executes a query with a sequence counter."""
12921293
logger.debug("_cmd_query")
@@ -1296,6 +1297,8 @@ def cmd_query(
12961297
"sequenceId": sequence_counter,
12971298
"querySubmissionTime": get_time_millis(),
12981299
}
1300+
if dataframe_ast is not None:
1301+
data["dataframeAst"] = dataframe_ast
12991302
if statement_params is not None:
13001303
data["parameters"] = statement_params
13011304
if is_internal:

src/snowflake/connector/cursor.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ def _execute_helper(
601601
_no_results: bool = False,
602602
_is_put_get=None,
603603
_no_retry: bool = False,
604+
dataframe_ast: str | None = None,
604605
) -> dict[str, Any]:
605606
del self.messages[:]
606607

@@ -704,6 +705,7 @@ def interrupt_handler(*_): # pragma: no cover
704705
_no_results=_no_results,
705706
_no_retry=_no_retry,
706707
timeout=real_timeout,
708+
dataframe_ast=dataframe_ast,
707709
)
708710
finally:
709711
try:
@@ -809,6 +811,7 @@ def execute(
809811
_skip_upload_on_content_match: bool = False,
810812
file_stream: IO[bytes] | None = None,
811813
num_statements: int | None = None,
814+
_dataframe_ast: str | None = None,
812815
) -> Self | None: ...
813816

814817
@overload
@@ -838,6 +841,7 @@ def execute(
838841
_skip_upload_on_content_match: bool = False,
839842
file_stream: IO[bytes] | None = None,
840843
num_statements: int | None = None,
844+
_dataframe_ast: str | None = None,
841845
) -> dict[str, Any] | None: ...
842846

843847
def execute(
@@ -866,6 +870,7 @@ def execute(
866870
_skip_upload_on_content_match: bool = False,
867871
file_stream: IO[bytes] | None = None,
868872
num_statements: int | None = None,
873+
_dataframe_ast: str | None = None,
869874
) -> Self | dict[str, Any] | None:
870875
"""Executes a command/query.
871876
@@ -900,6 +905,7 @@ def execute(
900905
file_stream: File-like object to be uploaded with PUT
901906
num_statements: Query level parameter submitted in _statement_params constraining exact number of
902907
statements being submitted (or 0 if submitting an uncounted number) when using a multi-statement query.
908+
_dataframe_ast: Base64-encoded dataframe request abstract syntax tree.
903909
904910
Returns:
905911
The cursor itself, or None if some error happened, or the response returned
@@ -941,6 +947,7 @@ def execute(
941947
"_no_results": _no_results,
942948
"_is_put_get": _is_put_get,
943949
"_no_retry": _no_retry,
950+
"dataframe_ast": _dataframe_ast,
944951
}
945952

946953
if self._connection.is_pyformat:

0 commit comments

Comments
 (0)