snowflake.snowpark.Session.call_nowait

Session.call_nowait(sproc_name: str, *args: Any, statement_params: Optional[Dict[str, Any]] = None, log_on_exception: bool = False, return_dataframe: Optional[bool] = None) AsyncJob[source]

Calls a stored procedure by name asynchronously and returns an AsyncJob. It is equivalent to call(block=False).

Parameters:
  • sproc_name – The name of stored procedure in Snowflake.

  • args – Arguments should be basic Python types.

  • 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.

Returns:

An AsyncJob object that can be used to retrieve results or check status.

Example:

>>> import snowflake.snowpark
>>> from snowflake.snowpark.functions import sproc
>>> import time
>>>
>>> session.add_packages('snowflake-snowpark-python')
>>>
>>> @sproc(name="simple_add_sp", replace=True)
... def simple_add(session: snowflake.snowpark.Session, a: int, b: int) -> int:
...     return a + b
>>> async_job = session.call_nowait("simple_add_sp", 1, 2)
>>> while not async_job.is_done():
...     time.sleep(1.0)
>>> async_job.is_done()
True
>>> async_job.is_failed()
False
>>> async_job.status()
'SUCCESS'
>>> result = async_job.result()
>>> print(result)
3
Copy