User-Defined Table Functions

User-defined table functions (UDTFs) in Snowpark. Please see Python UDTF for details. There is also vectorized UDTF. Compared to the default row-by-row processing pattern of a normal UDTF, which sometimes is inefficient, vectorized Python UDTFs (user-defined table functions) enable seamless partition-by-partition processing by operating on partitions as Pandas DataFrames and returning results as Pandas DataFrames or lists of Pandas arrays or Pandas Series.

In addition, vectorized Python UDTFs allow for easy integration with libraries that operate on pandas DataFrames or pandas arrays.

A vectorized UDTF handler class:
  • defines an end_partition method that takes in a DataFrame argument and returns a pandas.DataFrame or a tuple of pandas.Series or pandas.arrays where each array is a column.

  • does NOT define a process method.

  • optionally defines a handler class with an __init__ method which will be invoked before processing each partition.


A vectorized UDTF must be called with partition_by() to build the partitions.

Refer to UDTFRegistration for details and sample code on how to create regular and vectorized UDTFs using Snowpark Python API.



Provides methods to register classes as UDTFs in the Snowflake database.

UserDefinedTableFunction(handler, ...)

Encapsulates a user defined table function that is returned by udtf(), UDTFRegistration.register() or UDTFRegistration.register_from_file().


register(handler, output_schema[, ...])

Registers a Python class as a Snowflake Python UDTF and returns the UDTF.

register_from_file(file_path, handler_name, ...)

Registers a Python class as a Snowflake Python UDTF from a Python or zip file, and returns the UDTF.



The Python class or a tuple containing the Python file path and the function name.


The UDTF name.