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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
VivekGoli1203
New Contributor

Publishing a User Data Function is giving error

I have created a Fabric SQL Database. Created a User Data Function and added the connection to SQL Database in Manage Connections section of the UDF. Then I have pasted the sample code that Microsoft Tutorial has given. Publishing the UDF is giving the below error.

VivekGoli1203_0-1751005661452.png

Unexpected token '<', "<!--# QVsM"... is not valid JSON

 

Link to tutorial : https://learn.microsoft.com/en-us/power-bi/create-reports/translytical-task-flow-tutorial

1 ACCEPTED SOLUTION
v-prasare
Honored Contributor II

In this scenario i suggest you to raise a support ticket here. so, that they can assit you in addressing the issue you are facing. please follow below link on how to raise a support ticket:

How to create a Fabric and Power BI Support ticket - Power BI | Microsoft Learn

 

 

 

Thanks,

Prashanth Are

MS Fabric community support

View solution in original post

9 REPLIES 9
v-prasare
Honored Contributor II

Hi @VivekGoli1203,

 

we are looking to your scenario and will post answer once were tried reproducing it.

 

 

 

Thanks,

Prashanth Are

MS Fabric community support

VivekGoli1203
New Contributor

Hello Prashanth, Please respond if you find any solution

v-prasare
Honored Contributor II

Hi @VivekGoli1203,

As i have tried and implimeted below mentioned: Create a translytical task flow (https://learn.microsoft.com/en-us/power-bi/create-reports/translytical-task-flow-tutorial#test-the-s...)

when i run the UDF mentioned in the docs, it gives me success message without any errors. Can you try again once replacing the default code with the code given in the documentation. there might have been extra typos mistakes have added while copying code that might result in error.

 

vprasare_0-1751275451518.png

 

 

 

Thanks,

Prashanth Are

MS Fabric community support

 

If my answer helps please accept as solution, by doing this users with similar issues find answers easily.

 

I have used the correst code from the turorial, with correct data connection to Fabric SQL Database.

But it has given error in my tenant. But in other tenant of our organisation it worked fine.

v-prasare
Honored Contributor II

In this scenario i suggest you to raise a support ticket here. so, that they can assit you in addressing the issue you are facing. please follow below link on how to raise a support ticket:

How to create a Fabric and Power BI Support ticket - Power BI | Microsoft Learn

 

 

 

Thanks,

Prashanth Are

MS Fabric community support

Okay Prashanth thank you

BhaveshPatel
Honored Contributor

Just curious that why do we need User Data Function in Fabric SQL Database?? Use Kimball methodology/ Dimensional Modelling wherever we can. ( DimTable <--> Fact Table )

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

I am trying to implement write back in a Power Bi report, so as per the newly introduced translytical workflows tutorial it asked to create a UDF that takes values from report as parameters and updates them in the Fabric SQL Database.

This write back functionlity in Power BI is not available in User Defined Functions. You should do (write back functionilty) this in DWH aka Data Lakehouse. ( in Apache Spark with Python and INSERT ) . I will give you an example:


Writing data back to Azure SQL Database


# Create DataFrame to insert into the Azure SQL table ( Writing Data to Azure SQL Table )
#  
df1 = spark.createDataFrame([('WL2456', 'Luke1293', 'Skywalker','Null','Null',-3,'Unknown','Unknown','Null')], ['DeviceID', 'DeviceName', 'DeviceDesc','OperatorName','OperatorDesc','FacilityID','FacilityName','FacilityDesc','DeviceSerialNo'])

# Insert the rows into the Azure SQL table
df1.write \
    .option('user', user) \
   .option('password', pswd) \
   .jdbc('jdbc:sqlserver://' + sqlserver + ':' + port + ';database=' + database, 'dbo.Devices', mode = 'append' )
   
   
df1.show()
Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

Helpful resources

Announcements
Users online (25)