Forum Discussion

SergioTorrinha's avatar
SergioTorrinha
Icon for Resolver II rankResolver II
2 years ago
Solved

Lakehouse table column names not reflected in SQL Endpoint after a rename operation

Hi everyone! Recently, I have renamed some of the columns on a delta table I have in my lakehouse. The 'new' column names are being displayed exactly how I want in the lakehouse UI, but in the SQ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi SergioTorrinha 

    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.