Loading...

Fabric Data Warehouse integration with Fabric User Data Functions (Preview)

Fabric Data Warehouse integration with Fabric User Data Functions (Preview)

Microsoft Fabric Data Warehouse now integrates with Fabric User Data Functions in preview, so you can extend T-SQL with custom Python logic without building separate applications or pipelines. Use the integration to send email or Teams messages, retrieve parameters and secrets from Fabric variable libraries or Azure Key Vault, and access data across OneLake.

These capabilities are now available directly from T-SQL queries in your Warehouse.

 

Figure: Calling a Fabric User Data Function from a T-SQL query in Fabric Data Warehouse.

You can create T-SQL external functions in Fabric Data Warehouse that reference Python functions in a Fabric User Data Functions item. You can then invoke those functions from familiar statements such as SELECT, INSERT, and UPDATE. When an external function is called, Data Warehouse delegates its execution to the Fabric User Data Functions runtime.

This integration enables scenarios such as:

  • Calling Fabric or external APIs and sending email, Teams messages, or notifications.
  • Reading Excel, XML, PDF, and other file formats through Python.
  • Accessing data in OneLake and reading from or writing to Fabric databases, Azure Cosmos DB, and warehouses across workspaces.
  • Retrieving secrets and configuration values from Azure Key Vault or Fabric variable libraries to parameterize custom logic.
  • Encrypting, decrypting, or masking sensitive columns with custom Python logic and organization-managed keys.
  • Enriching and validating data by geocoding addresses, verifying VAT or IBAN numbers, or scoring records with a machine learning model.

Example: Use Python to classify IPv6 network events from T-SQL

Classifying IPv6 events by network prefix can support security analysis, but the required parsing and binary arithmetic are complex in T-SQL. Python provides a purpose-built standard library for this task, allowing warehouses that store network and security telemetry to organize events into consistent network ranges for analysis.

In this example, Python’s ipaddress function accepts an IPv6 address and prefix length and returns the corresponding network in CIDR notation. Persisting this value as an analytics column lets downstream queries group events into consistent network ranges without repeating calculation.

import ipaddress
import fabric.functions as fn

udf = fn.UserDataFunctions()

@udf.function()
def getIpv6Network(address: str, prefixLength: int) -> str:
    interface = ipaddress.ip_interface(f"{address}/{prefixLength}")
    return str(interface.network)

The published Python function is mapped to a T-SQL external function that accepts an IPv6 address and prefix length and returns the corresponding network prefix in CIDR notation.

CREATE FUNCTION ipv6.get_network
AS EXTERNAL FUNCTION utilities.getIpv6Network;

You can then calculate and persist a /48 network prefix for each event:

UPDATE dbo.NetworkEvents
SET NetworkPrefix = ipv6.get_network(SourceIp, 48)
WHERE NetworkPrefix IS NULL;

Each call to ipv6.get_network delegates execution to the Fabric User Data Function runtime. After the result is stored in NetworkPrefix column, downstream queries can use it without recalculating the prefix.

Conclusion

Fabric User Data Functions let teams continue working in T-SQL while using Python to address scenarios that traditionally require separate applications or pipelines. Explore the preview and start extending your Fabric Data Warehouse solutions with custom logic today.

You learn how to use the User Data Functions in Fabric Data Warehouse in the documentation.

Try this feature during the preview and share your feedback with the Microsoft Fabric community on Reddit.

Published on:

Learn more
Need help with this product?

We can help you with Fabric Data Warehouse integration with Fabric User Data Functions (Preview)

If you want help implementing, troubleshooting, or improving this product, contact us and we’ll point you in the right direction.

Power BI Updates Blog articles
Power BI Updates Blog articles

Power BI Updates Blog articles

Share post:

Related posts

Newsletter

Get the latest Dynamics 365 and Power Platform content in your inbox

A curated digest of community blogs, product news, videos, and podcasts — delivered without the noise.

Weekly updates Unsubscribe anytime Fresh community picks
We use your email only for the newsletter and you can unsubscribe at any time.
By subscribing, you agree to the privacy policy.