You can run UPDATE/INSERT/DELETE Statements on Azure SQL Database in Microsoft Fabric Notebook using Python SQL Driver - pyodbc.
For the Fabric Notebook, the driver is "{ODBC Driver 18 for SQL Server}"
Sample code is below:
import pyodbc
server = "servername.database.windows.net"
database = "databasename"
username = "user"
password = "password"
driver= "{ODBC Driver 18 for SQL Server}"
strsql = "Your SQL Statement"
with pyodbc.connect('DRIVER='+driver+';SERVER=tcp:'+server+';PORT=1433;DATABASE='+database+';UID='+username+';PWD='+ password) as conn:
with conn.cursor() as cursor:
cursor.execute(strsql)
No comments:
Post a Comment