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 guys,
Is it possible to create a stored proc on Fabric lakehouse from a notebook?
Solved! Go to Solution.
HI @Soobramoney,
Perhaps you can use the pyodbc to connect to the data source and execute the create SP command:
import pyodbc
# copy and paste the SQL endpoint from any of the Lakehouses or Warehouses in your Fabric Workspace
server = "your endpoint"
# copy and paste the name of the Lakehouse or Warehouse you want to connect to
database="YourDatabase"
# use Service principal to connect
clientId = ""
clientSecret = mssparkutils.credentials.getSecret("https://YourKeyVault.vault.azure.net/","your-client-secret-secret-name")
constr = f"driver=ODBC Driver 18 for SQL Server;server={server};database={database};UID={clientId};PWD={clientSecret};Authentication=ActiveDirectoryServicePrincipal;Encrypt=yes;Timeout=60;"
con = pyodbc.connect(constr)
cursor = con.cursor()
create_SP_Command=""
result=cursor.execute(create_SP_Command)
print(result)
cursor.close()
con.close()
Load data to MS Fabric Warehouse from notebook - Stack Overflow
Regards,
Xiaoxin Sheng
HI @Soobramoney,
Perhaps you can use the pyodbc to connect to the data source and execute the create SP command:
import pyodbc
# copy and paste the SQL endpoint from any of the Lakehouses or Warehouses in your Fabric Workspace
server = "your endpoint"
# copy and paste the name of the Lakehouse or Warehouse you want to connect to
database="YourDatabase"
# use Service principal to connect
clientId = ""
clientSecret = mssparkutils.credentials.getSecret("https://YourKeyVault.vault.azure.net/","your-client-secret-secret-name")
constr = f"driver=ODBC Driver 18 for SQL Server;server={server};database={database};UID={clientId};PWD={clientSecret};Authentication=ActiveDirectoryServicePrincipal;Encrypt=yes;Timeout=60;"
con = pyodbc.connect(constr)
cursor = con.cursor()
create_SP_Command=""
result=cursor.execute(create_SP_Command)
print(result)
cursor.close()
con.close()
Load data to MS Fabric Warehouse from notebook - Stack Overflow
Regards,
Xiaoxin Sheng
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Fabric update to learn about new features.
User | Count |
---|---|
4 | |
4 | |
3 | |
2 | |
2 |
User | Count |
---|---|
16 | |
15 | |
4 | |
4 | |
3 |