Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All,
I have created new Fabric SQL database. On this Fabric database I want to perform various operation on Fabric SQL database table like Insert/update/delete specifically from Fabric Notebook within same Workspace.
I tried DMP opertaion using Data pipeline which is working fine BUT we need these DMP opertation to be performed from existing Notebooks.
Kindly help how do I need to connect to Fabric SQL database from Fabric notebook and perform DML operation.
Thanks in advance
Solved! Go to Solution.
Hi @mail2atulm,
To perform INSERT, UPDATE, and Delete operations on your Fabric SQL database directly from a Fabric notebook within the same workspace. If your database is a Fabric Warehouse or a Mirrored SQL database with an analytics endpoint, the easiest way is to use the %%sql magic command in the notebook. You can simply write standard T-SQL commands like INSERT, UPDATE or Delete inside a %%sql cell, and it will execute directly against your database.
If you're using a Spark-based notebook or need more control, you can also connect to your Fabric SQL database using a JDBC connection within Python. This lets you write data from a DataFrame to your SQL table or execute more complex logic programmatically. You'll need your database connection details like the endpoint, database name, and credentials (or managed identity), and then you can use Spark’s write jdbc() function to perform your DML tasks. For more detailed guidance, you can refer to the official documentation on connecting to your SQL database in Microsoft Fabric: Connect to Your SQL Database - Microsoft Fabric.(Microsoft Learn)
Thanks,
Prashanth Are
MS Fabric community support
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query
Hi @mail2atulm,
To perform INSERT, UPDATE, and Delete operations on your Fabric SQL database directly from a Fabric notebook within the same workspace. If your database is a Fabric Warehouse or a Mirrored SQL database with an analytics endpoint, the easiest way is to use the %%sql magic command in the notebook. You can simply write standard T-SQL commands like INSERT, UPDATE or Delete inside a %%sql cell, and it will execute directly against your database.
If you're using a Spark-based notebook or need more control, you can also connect to your Fabric SQL database using a JDBC connection within Python. This lets you write data from a DataFrame to your SQL table or execute more complex logic programmatically. You'll need your database connection details like the endpoint, database name, and credentials (or managed identity), and then you can use Spark’s write jdbc() function to perform your DML tasks. For more detailed guidance, you can refer to the official documentation on connecting to your SQL database in Microsoft Fabric: Connect to Your SQL Database - Microsoft Fabric.(Microsoft Learn)
Thanks,
Prashanth Are
MS Fabric community support
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query