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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
bruinsmm
Frequent Visitor

Parameters FabricVariablesClient and FabricLakehouseClient in one udf function

When i use one UDF function with 2 parameters:  myLakehouseDEV: fn.FabricLakehouseClient and var: fn.FabricVariablesClient i got and error, see below. When i use 2 UDF functions, one for FabricLakehouseClient and one for FabricVariablesClient, it works. Why can i not combine these parameters? A bug ?

 

 

Error message:

{

  "functionName": "query_data",

  "invocationId": "00000000-0000-0000-0000-000000000000",

  "status": "Failed",

  "errors": [

    {

      "errorCode": "WorkloadException",

      "subErrorCode": "InternalServerError",

      "message": "An internal execution error occured"

    }

  ]

}

 

Source code:

 

@udf.connection(argName="myLakehouseTEST", alias="lhbronzesharedDEV")

@udf.connection(argName="var", alias="varlib")

@udf.function()

def query_data(myLakehouseTEST: fn.FabricLakehouseClient, var: fn.FabricVariablesClient) -> list:

 

    connection = myLakehouseTEST.connectToSql()

   

    cursor = connection.cursor()

    cursor.execute(f"SELECT NAAM_NL, NAAM_EN FROM MDR.LAND WHERE LAND_ID = 142;")

   

    rows = [x for x in cursor]

    columnNames = [x[0] for x in cursor.description]

   

    values = []

    for row in rows:

        item = {}

        for prop, val in zip(columnNames, row):

            item[prop] = val

        values.append(item)

 

    # Close the connection

    cursor.close()

    connection.close()

 

    return values

1 ACCEPTED SOLUTION
nielsvdc
Super User
Super User

@bruinsmm  @Mauro89 

Thanks @OnurOz for the code. I had contact with someone from Microsoft team today and today the code worked in my tenant and theirs. So the issue seems fixed and it should now work in your environment.

 

View solution in original post

12 REPLIES 12
nielsvdc
Super User
Super User

@bruinsmm  @Mauro89 

Thanks @OnurOz for the code. I had contact with someone from Microsoft team today and today the code worked in my tenant and theirs. So the issue seems fixed and it should now work in your environment.

 

@nielsvdc thanks. i have try the udf code. Now it works.

OnurOz
Resolver III
Resolver III

Hi @bruinsmm 

 

this looks to me like an undocumented runtime limitation or a bug. Because I am getting the same error too.
However, in official github repository for the UDFs, I saw an example that requires that this works:

fabric-user-data-functions-samples/PYTHON/Warehouse/export_warehouse_data_to_lakehouse.py at main · ...

 

In the example above, I see two connections injected.

 

I suggest filing a bug to the team using this link: https://github.com/microsoft/fabric-user-data-functions-samples/issues

 

Hope that helps

Onur


😊 If this post helped you, feel free to give it some Kudos! 👍

And if it answered your question, please mark it as the accepted solution.


I've dug more into this and identified a very weird behaviour. If I use FabricSQLConnection together with the FabricLakehouseClient it works. However If I use the FabricVariablesClient together with any of them, that is not working and throwing exactly the same internal error.

 

import fabric.functions as fn

udf = fn.UserDataFunctions()


@udf.connection(argName="variables", alias="varlib")
@udf.function()
def this_works(variables: fn.FabricVariablesClient )-> str:    
    return variables.getVariables()["x"]


@udf.connection(argName="variables", alias="varlib")
@udf.connection(argName="myWarehouse", alias="fabWH")
@udf.function()
def this_fails(variables: fn.FabricVariablesClient, myWarehouse: fn.FabricSqlConnection, )-> str:    
    return variables.getVariables()["x"]


@udf.connection(argName="variables", alias="varlib")
@udf.connection(argName="myLakehouse", alias="fablakehouse")
@udf.function()
def this_fails_too(variables: fn.FabricVariablesClient, myLakehouse: fn.FabricLakehouseClient, )-> str:    
    return variables.getVariables()["x"]






Hi @OnurOz, it looks like this is unwanted behavior. Are you able to create a support request at Microsoft for this? I can also offer to help do this.

Hi @nielsvdc Due to circumstances, we cannot submit this problem to Microsoft. Would you please submit this problem to Microsoft? 

I have reported the issue under request ID 2512121420001293.

@nielsvdc  thanks for your help

Hi @OnurOz and @nielsvdc thanks for your help. I will pass the problem to my colleague who can contact with Microsoft.

Hi @bruinsmm 
I hope you’ve submitted the support ticket. Once you receive a solution, please share it here so it can help others facing the same issue. If you have any further questions, feel free to reach out to the community.

Thanks.

Mauro89
Super User
Super User

Hi @bruinsmm,

 

have you used the defined aliases and checked if both connections are actually there?

 

Best regards!

Hi @Mauro89 ,

If i use one function with FabricLakehouseClient and one function with FabricVariablesClient, it works. so the aliases are set up correctly. 

Helpful resources

Announcements
FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Fabric Update Carousel

Fabric Monthly Update - March 2026

Check out the March 2026 Fabric update to learn about new features.