Forum Discussion
Load custom SQL function from Azure Synapse into Microsoft Fabric Lakehouse
- 1 year ago
Hi mtomova
- After creating stored procedure in Azure Synapse that includes your custom SQL function, create a pipeline Script activity to run the stored procedure in Fabric environment.
- Then in the pipeline use copy asiatnat activity to load preprocessed table data into Lakehouse. Now, execute the two pipeline activities to load the data in to your Lakehouse.
Please go through this official documentaion Preprocess data with a stored procedure before loading into Lakehouse - Microsoft Fabric | Microsoft Learn it might helps you to solve your problem.
Thank you!
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
Hi mtomova,
Thank you for following up to the conversation. I understand that you're facing an issue where your SQL function in Fabric works when passing parameters directly but runs indefinitely when used inside another query.
This is likely happening due to how Fabric’s SQL engine handles functions, particularly with recursive or row-by-row operations. Unlike Azure Synapse, Fabric does not fully optimize T-SQL scalar functions, which can cause performance issues when applied to large datasets.
Instead of using a function to count working days dynamically, you can create a working days calendar table and use a direct query. You can create a Calendar Table that marks weekends and holidays as non-working days and once the table is created, you can use a simple query instead of a fucntion to count working days between two dates.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Best Regards,
Hammad.
Community Support Team
If this post helps then please mark it as a solution, so that other members find it more quickly.
Thank you.
Hi Anonymous ,
thanks for the idea. I will probably explore it, because as you have said T-SQL scalar functions cause performance issues in Fabric..
Thanks,
Maria