Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe'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
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
Solved! Go to Solution.
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.
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.
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.
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.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 28 | |
| 11 | |
| 8 | |
| 8 | |
| 5 |