Forum Discussion

arpost's avatar
arpost
Post Prodigy
2 months ago
Solved

Can notebooks trigger SQL stored procedures in 2026?

Greetings, community. I know Microsoft has released some newer features around notebooks and SQL interactions, so I was wondering: is it possible to trigger a sproc in a Fabric DW from a Fabric noteb...
  • GilbertQ's avatar
    2 months ago

    Hi arpost 

     

    The way I would approach this is to use a data pipeline or a pipeline where you could have the first 5 cells in your notebook running something. Once that completes, you then execute the stored procedures followed by the next step where you have another notebook which concretes the additional cells in your notebook. This way it'll also allow you to know if something fails in the pipeline, where it is failed, or easier troubleshooting and potentially. Problem solving.

  • RajeshM's avatar
    2 months ago

    I agree with GilbertQ  about calling notebooks and stored procs from a pipeline as you have better control.

     

    If you must call the stored proc from the notebook, they have released a feature that's in preview.

     

    Make sure its a "python" notebook (not pyspark (python)). 

    You will have to pass the magic command as follows:
    %%tsql -artifact NameOfYourFabricWarehouse -type Warehouse -bind df1

     

    You can find more details here: https://learn.microsoft.com/en-us/fabric/data-engineering/tsql-magic-command-notebook#using-t-sql-magic-command-to-query-fabric-data-warehouse

     

     

    If you like my answer, please gives a thumbs up. If I have answered you correctly, please mark this as a solution.

     

    Best Regards,

    Rajesh