All Products
Search
Document Center

MaxCompute:Update a function

Last Updated:Mar 25, 2026

Updates a user-defined function (UDF) in a MaxCompute project using the PyODPS SDK. To update a function, get the function object, modify its properties, then call update().

Updatable properties

The following properties can be updated without dropping and recreating the function.

PropertyTypeDescription
class_typeStringThe fully qualified class name that implements the UDF, in the format <module>.<ClassName>
resourcesListThe resource objects that the UDF depends on

Example

# Get the existing function object
function = o.get_function('test_function')

# Get the new resource to attach
new_resource = o.get_resource('my_udf2.py')

# Update properties
function.class_type = 'my_udf2.Test'
function.resources = [new_resource]

# Persist changes to MaxCompute
function.update()

What's next

  • FUNCTION: Create temporary SQL functions that are not stored in the MaxCompute metadata system and apply only to the current SQL script

  • CREATE FUNCTION: Create a UDF using create_function()

  • DELETE FUNCTION: Delete a UDF using delete_function()

  • DROP FUNCTION: Delete an existing UDF from a MaxCompute project

  • DESC FUNCTION: View UDF details, including name, owner, creation time, class name, and resource list

  • LIST FUNCTIONS: List all UDFs in a MaxCompute project