Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to update a table stored in fabric data warehouse from spark note book in fabric?I

I have a control table in in fabric data warehouse .I need to update the control table from spark notebook.

5 REPLIES 5
Anonymous
Not applicable

Hi @Anonymous ,

 

Is my follow-up just to ask if the problem has been solved?

 

If so, can you accept the correct answer as a solution or share your solution to help other members find it faster?

 

Thank you very much for your cooperation!

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Anonymous
Not applicable

Hi @Anonymous ,

 

Thanks for the reply from frithjof_v .

 

To update the table in the Fabric Data Warehouse from Lakehouse's notebook, you can use Pyodbc, here is an example:

 

import pyodbc

# SQL endpoint from your Lakehouse or Warehouse
server = "your_SQL endpoint"
# Name of the Lakehouse or Warehouse
database = "databaseName"

# Service principal credentials
clientId = "xxxxx"
clientSecret = "xxxxx"

# Connection string
constr = f"driver=ODBC Driver 18 for SQL Server;server={server};database={database};UID={clientId};PWD={clientSecret};Authentication=ActiveDirectoryServicePrincipal;Encrypt=yes;Timeout=60;"

# Connect to the database
con = pyodbc.connect(constr)
cursor = con.cursor()

# SQL command to rename the column in DimProduct table
update_command = """
ALTER TABLE DimProduct
RENAME COLUMN ProductName TO Name;
"""

# Execute the command
cursor.execute(update_command)
con.commit()

# Close the connection
cursor.close()
con.close()

print("Update successful")

 

 

Replace server, database, clientId, and clientSecret with your own information.

 

If you have any other questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Anonymous
Not applicable

I executed this code with my credentials and details but got this error. Any idea
InterfaceError
: ('28000', '[28000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Could not login because the authentication failed. (18456) (SQLDriverConnect)')

frithjof_v
Super User
Super User

Perhaps you can use Pyodbc:

 

https://debruyn.dev/2023/connect-to-fabric-lakehouses-warehouses-from-python-code/

 

I never tried it myself

Helpful resources

Announcements
Fabric July 2025 Monthly Update Carousel

Fabric Monthly Update - July 2025

Check out the July 2025 Fabric update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.