0% found this document useful (0 votes)
154 views1 page

Calling Functions and Stored Procedures in Snowpark Python - Snowflake Documentation

The document discusses how to call SQL functions, user-defined functions, and stored procedures from Snowpark Python. It explains using built-in functions from the snowflake.snowpark.functions module, and how to call functions not available in the module using call_function or by creating a function object.

Uploaded by

demorepo99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
154 views1 page

Calling Functions and Stored Procedures in Snowpark Python - Snowflake Documentation

The document discusses how to call SQL functions, user-defined functions, and stored procedures from Snowpark Python. It explains using built-in functions from the snowflake.snowpark.functions module, and how to call functions not available in the module using call_function or by creating a function object.

Uploaded by

demorepo99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

4/29/24, 3:06 PM Calling Functions and Stored Procedures in Snowpark Python | Snowflake Documentation

Developer Snowpark API Python Calling Functions and Stored Procedures


Calling Functions and Stored Procedures in
Snowpark Python
To process data in a DataFrame, you can call system-defined SQL functions, user-
defined functions, and stored procedures. This topic explains how to call these in
Snowpark.
To process data in a DataFrame, you can call system-defined SQL functions, user-
defined functions, and stored procedures.
Calling System-Defined Functions
If you need to call system-defined SQL functions, use the equivalent functions in
the snowflake.snowpark.functions module.
The following example calls the upper function in the functions module (the
equivalent of the system-defined UPPER function) to return the values in the name
column of the sample_product_data table with the letters in uppercase:
>>> # Import the upper function from the functions module.
>>> from snowflake.snowpark.functions import upper, col
>>> session.table("sample_product_data").select(upper(col("name")).al
[Row(UPPER_NAME='PRODUCT 1'), Row(UPPER_NAME='PRODUCT 1A'), Row(UPPER

If a system-defined SQL function is not available in the functions module, you can
use one of the following approaches:
Use the call_function function to call the system-defined function.
Use the function function to create a function object that you can use to call
the system-defined function.
call_function and function are defined in the snowflake.snowpark.functions
module.
For call_function , pass the name of the system-defined function as the first
argument. If you need to pass the values of columns to the system-defined
function, define and pass Column objects as additional arguments to the
call_function function.

The following example calls the system-defined function RADIANS passing in the
https://docs.snowflake.com/en/developer-guide/snowpark/python/calling-functions 1/1

You might also like