Forum Discussion
VivekGoli1203
1 year agoRegular Visitor
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...
BhaveshPatel
1 year agoSuper User
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 )
VivekGoli1203
1 year agoRegular Visitor
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.
- BhaveshPatel1 year agoSuper User
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 tabledf1.write \.option('user', user) \.option('password', pswd) \.jdbc('jdbc:sqlserver://' + sqlserver + ':' + port + ';database=' + database, 'dbo.Devices', mode = 'append' )df1.show()