Forum Discussion
Lakehouse table column names not reflected in SQL Endpoint after a rename operation
- Anonymous2 years ago
Currently ALTER TABLE command is not supported for tables in Lakehouse and Warehouse. So when you try to modify the table using Spark code it might result in some issues.
But as a work around I would suggest the following steps:1) I have a table named List in my lakehouse with one of the column named "genre".
2) Run the below given code by dropping the column required. You can also try renaming the column. Create a new table named list1.3) Delete the original list table from the lakehouse.
4) Now run the below code which will create a new table with name as List with the dropped column.5) This table can be accessed from the SQL endpoint also.
We also have a Microsoft Idea where users requested for a feature to add or remove columns in a Lakehouse table without having to delete and recreate the table. Please upvote this.
Microsoft Idea
Hope this helps. Please let me know if you have any further questions. Glad to help.
Hi SergioTorrinha
Thanks for using Fabric Community.
You have written the code correctly. Currently rename a table in lakehouse, and ALTER table functions, adding new columns, renaming columns in a Lakehouse table is not supported in Fabric. You can change the schema of a lakehouse table by using a notebook and advancing the schema if your table is a delta table. The lakehouse sql endpoint won't let you do any schema (or data) modifications.
Hope this helps. Please let me know if you have any further queries.