cancel
Showing results for 
Search instead for 
Did you mean: 
Warehousing & Analytics
Engage in discussions on data warehousing, analytics, and BI solutions within the Databricks Community. Share insights, tips, and best practices for leveraging data for informed decision-making.
cancel
Showing results for 
Search instead for 
Did you mean: 

Python UDTF

data-grassroots
New Contributor III

Attempting to create a Python UDF and receiving an error stating it's not supported in my environment.

running on SQL Serverless Cluster - Preview (v 2025.16)

[FEATURE UNAVAILABLE]

Python UDTF is not supported in your environment.

To use this feature, please contact Databricks Support. SQLSTATE: 56038

 

create function _rrr_taxonomy_test()
RETURNS TABLE(dept string, cat string, subcat string)
LANGUAGE PYTHON
AS
$$
s = '''select
custom_department as dept,
custom_category as cat,
coalesce(custom_sub_category, '') as subcat
from item'''
 
return spark.sql(s)
$$
1 REPLY 1

nayan_wylde
Honored Contributor II

Currently Serverless supports only scaler valued function not table valued function. also you need to provide the catalog and schema in the function.

You can create using a pro compute

create function {catalog_name}.{schema_name}._rrr_taxonomy_test()
RETURNS TABLE(dept string, cat string, subcat string)
LANGUAGE PYTHON
AS
$$
= '''select
custom_department as dept,
custom_category as cat,
coalesce(custom_sub_category, '') as subcat
from item'''
 
return spark.sql(s)
$$
 
 
I tried this function in serverless and it worked it is a scaler valued function.
 
create function {catalog_name}.{schema_name}._rrr_taxonomy_test_1()
RETURNS string
LANGUAGE PYTHON
AS
$$
= '"Hello World"
 
 
return s
$$