snowflake.snowpark.functions.function¶

snowflake.snowpark.functions.function(function_name: str) → Callable[source]¶

Function object to invoke a Snowflake system-defined function (built-in function). Use this to invoke any built-in functions not explicitly listed in this object.

Parameters:

function_name – The name of built-in function in Snowflake.

Returns:

A Callable object for calling a Snowflake system-defined function.

Example::
>>> df = session.create_dataframe([1, 2, 3, 4], schema=["a"])  # a single column with 4 rows
>>> df.select(call_function("avg", col("a"))).show()
----------------
|"AVG(""A"")"  |
----------------
|2.500000      |
----------------

>>> my_avg = function('avg')
>>> df.select(my_avg(col("a"))).show()
----------------
|"AVG(""A"")"  |
----------------
|2.500000      |
----------------
Copy