Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

mk_sunitha

Support for default arguments in Fabric User data functions

If you haven’t already, check out Arun Ulag’s hero blog “FabCon and SQLCon 2026: Unifying databases and Fabric on a single, complete platform” for a complete look at all of our FabCon and SQLCon announcements across both Fabric and our database offerings. 


The Fabric user data functions (UDF) programmability model now includes the ability to define functions with default argument values. This feature allows you streamline your workflow by minimizing the need to specify every argument each time you call a function—any parameters you leave out will automatically use their default values. As a result, you can write cleaner, more concise code and focus on the logic that matters most.

How to write functions with default values

You can define default arguments in Fabric user data functions to make your code easier to call and maintain. Default values support common JSON-serializable types, including strings, boolean, numbers (int, float), arrays (lists), and objects (dictionaries).

Syntax

@udf.function()

def function_name(param1: type = value1, param2: type = value2, listparam: list | None = None, ...) -> output_type:

# function body

Input types supported

The following are the input types supported for which you can pass default values.
JSON type Python data type
String str
Date/time string datetime (for example, ISO 8601 input parsed to datetime)
Boolean bool
Number int, float
Array list (eg. list[int])
Object dict
Object or array of objects pandas DataFrame, pandas Series
Figure: User data functions input types.

Limitations

The default value must be JSON serializable. For example, nested lists such as [1, 2, [3]] are permitted, whereas nested sets or tuples are not supported. For list or dictionary defaults, prefer using None in the signature and assigning the real default inside the function. For date/time defaults passed as strings, use a consistent format (for example, ISO 8601).

Example scenario: Data quality triage tags for a support or reviews pipeline

Records from sources like customer feedback, product reviews, support tickets, telemetry anomalies, or compliance events are ingested into Fabric. Often, records lack metadata such as tags, severity, or review status, which downstream processes need. UDF normalizes the dataset by retaining existing tags or marking untagged records as "new" and "unreviewed" for triage.

import fabric.functions as fn

udf = fn.UserDataFunctions()

@udf.function()

def add_tags(record: dict, default_tags: list | None = None) -> dict:

"""

Adds default tags to a record if no tags exist.

Args:

record (dict): Input row, e.g. {"id": 1, "tags": ["priority"]}.

default_tags (list): Tags applied when record has no tags.

Returns:

dict: Record with a final_tags list added.

"""

if default_tags is None:

default_tags = ["new", "unreviewed"]

tags = record.get("tags") or default_tags

return {**record, "final_tags": tags}

Output when you run the function:

If you call add_tags({"id": 1}) (omitting default_tags), the function applies ["new", "unreviewed"] and returns a record with final_tags set.

Get started

Get started working with Fabric user data functions. Learn more about User data functions programming model. Please share your feedback and ideas with us through the Fabric Ideas forums, so we can continue to improve and better support your needs.