Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#### Improvements

- Added support for reading XML files with namespaces using `rowTag` and `stripNamespaces` options.
- Added support for parameter `is_return_table` in `Session.call`, which can be used to set the return type of the functions a `DataFrame` object.
Copy link
Contributor

Choose a reason for hiding this comment

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

the call functions has parameter named return_dataframe while here it's called is_return_table
which name we want to use?


### Snowpark Local Testing Updates

Expand Down
4 changes: 4 additions & 0 deletions src/snowflake/snowpark/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4114,6 +4114,7 @@ def call(
*args: Any,
statement_params: Optional[Dict[str, Any]] = None,
log_on_exception: bool = False,
return_dataframe: Optional[bool] = None,
_emit_ast: bool = True,
) -> Any:
"""Calls a stored procedure by name.
Expand All @@ -4124,6 +4125,8 @@ def call(
statement_params: Dictionary of statement level parameters to be set while executing this action.
log_on_exception: Log warnings if they arise when trying to determine if the stored procedure
as a table return type.
return_dataframe: When set to True, the return value of this function is a DataFrame object.
This is useful when the given stored procedure's return type is a table.
Copy link
Contributor

@sfc-gh-aling sfc-gh-aling May 21, 2025

Choose a reason for hiding this comment

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

let's also add comment about default None behavior


Example::

Expand Down Expand Up @@ -4163,6 +4166,7 @@ def call(
*args,
statement_params=statement_params,
log_on_exception=log_on_exception,
is_return_table=return_dataframe,
_emit_ast=_emit_ast,
)

Expand Down
25 changes: 25 additions & 0 deletions tests/integ/test_stored_procedure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2120,3 +2120,28 @@ def upload_and_copy_into(session_):
# sproc execution
ingestion = sproc(upload_and_copy_into, return_type=StringType())
assert ingestion() == "success"


@pytest.mark.skipif(
"config.getoption('local_testing_mode', default=False)",
reason="data source is not supported in local testing",
run=False,
)
def test_procedure_with_default_value(session):
temp_sp_name = Utils.random_name_for_temp_object(TempObjectType.PROCEDURE)
sql = f"""
create temporary procedure {temp_sp_name}(col1 INT, col2 STRING default 'snowflake')
returns table(col1 INT, col2 STRING)
LANGUAGE PYTHON
RUNTIME_VERSION = '3.10'
packages = ('snowflake-snowpark-python', 'pandas')
HANDLER = 'my_handler'
AS $$
def my_handler(session, col1, col2):

return session.create_dataframe([[col1,col2]],schema=['col1','col2'])
$$;
"""
session.sql(sql).collect()
df = session.call(temp_sp_name, 1, return_dataframe=True)
Utils.check_answer(df, [Row(COL1=1, COL2="snowflake")])
Loading