Custom logic written in JavaScript and registered with a Cosmos DB container, callable only from queries. Calling one raises the request unit charge.
Also called user-defined function.
Read more: Microsoft Learn
In the Ultra Transcenders books
DBX-DEPDBX-GENAIAI-200DP-750DP-600DP-700DP-800
Each book explains UDF in context, with comparison tables and the common traps.
Terms in this definition
- Cosmos DB
NoSQL database distributed globally, offering writes in multiple regions, automatic indexing and latency below 10 ms.
- Container
Something that groups data. Blob Storage containers sit inside a storage account and hold blobs much as folders hold files; Cosmos DB containers hold items and set the scope for partitioning and throughput.
- RU
Request unit, the measure in which Azure Cosmos DB throughput is expressed. Analytical queries through Synapse Link use none of the transactional store's RUs.
Related terms
- ABAC policy
Governed tags drive this kind of Unity Catalog rule: when a table or column has tags that satisfy its
WHENandMATCH COLUMNSconditions, a row filter or column mask UDF is put on it automatically. Policies are written withCREATE POLICYand can sit on a metastore, catalog, schema or table. - CREATE FUNCTION
Adds a table function, or a Python or SQL UDF, to Unity Catalog so that it falls under governance like other objects. Doing so takes the relevant privilege on the schema.
- ENVIRONMENT clause
Declares what a Python UDF needs, namely its
environment_versionanddependencies, when the function is created withCREATE FUNCTION. - GETDATE
A T-SQL function giving the database system's current date and time as datetime, with GETUTCDATE returning the UTC equivalent. NEWID isn't allowed inside a user-defined function, but GETDATE is.
- HANDLER
Tells a Unity Catalog Python UDF which function in its body to start from, as part of
CREATE FUNCTION. In a batch UDF, that function receives an iterator ofpandas.Series. - NEWID
Returns a random uniqueidentifier. The values are not sequential, so indexes on them become fragmented; it also can't be called from within a user-defined function.
- PARAMETER STYLE PANDAS
Turns a Unity Catalog Python UDF into a batch function when used in
CREATE FUNCTION. ItsHANDLERreceives an iterator ofpandas.Series, and the output row count has to equal the input row count. - PREDICT
A Fabric function for scoring MLflow models in batches from a notebook, provided the models have signatures; you can call it via MLFlowTransformer, Spark SQL or a PySpark UDF. Fabric Warehouse does not support the T-SQL PREDICT statement.