<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Add or remove column in Lakehouse table in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3604118#M1891</link>
    <description>&lt;P&gt;Thanks for the reply&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/664218"&gt;@fabricator1&lt;/a&gt;&amp;nbsp;. Please do let me know if the work around helped you. Do let me know if you have any further questions.&lt;/P&gt;</description>
    <pubDate>Wed, 27 Dec 2023 19:45:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-12-27T19:45:08Z</dc:date>
    <item>
      <title>Add or remove column in Lakehouse table</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3603556#M1888</link>
      <description>&lt;P&gt;Can I add or remove a column from an existing Lakehouse table?&lt;BR /&gt;&lt;BR /&gt;I tried doing that on a lakehouse table (by using notebook), but then the table was not visible in the SQL Endpoint and in the Default semantic model afterwards.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2023 12:09:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3603556#M1888</guid>
      <dc:creator>fabricator1</dc:creator>
      <dc:date>2023-12-27T12:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Add or remove column in Lakehouse table</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3604063#M1889</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/664218"&gt;@fabricator1&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thanks for using Fabric Community.&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vnikhilanmsft_0-1703702253870.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1016676i9091BE0AC4C37271/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vnikhilanmsft_0-1703702253870.png" alt="vnikhilanmsft_0-1703702253870.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vnikhilanmsft_6-1703702855365.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1016682iCD0452B7A5866CA1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vnikhilanmsft_6-1703702855365.png" alt="vnikhilanmsft_6-1703702855365.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;But as a work around I would suggest the following steps:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;1) I have a table named List in my lakehouse with one of the column named "genre".&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vnikhilanmsft_1-1703702349074.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1016677i5AAAB01D014931BB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vnikhilanmsft_1-1703702349074.png" alt="vnikhilanmsft_1-1703702349074.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;2)&amp;nbsp; Run the below given code by dropping the column required. Create a new table named list1.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vnikhilanmsft_2-1703702474969.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1016678i644A8CDC0E9C3E5F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vnikhilanmsft_2-1703702474969.png" alt="vnikhilanmsft_2-1703702474969.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Delete the original list table from the lakehouse.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vnikhilanmsft_3-1703702563891.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1016679iF1BB5FB53B12676C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vnikhilanmsft_3-1703702563891.png" alt="vnikhilanmsft_3-1703702563891.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;4) Now run the below code which will create a new table with name as List with the dropped column.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vnikhilanmsft_4-1703702655668.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1016680iE0AE3E2540FA85DF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vnikhilanmsft_4-1703702655668.png" alt="vnikhilanmsft_4-1703702655668.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;5) This table can be accessed from the SQL endpoint also.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vnikhilanmsft_5-1703702712562.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1016681i13DEC8482029A9D9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vnikhilanmsft_5-1703702712562.png" alt="vnikhilanmsft_5-1703702712562.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Hope this helps. Please let me know if you have any further questions. Glad to help.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2023 18:51:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3604063#M1889</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-12-27T18:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Add or remove column in Lakehouse table</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3604095#M1890</link>
      <description>&lt;P&gt;Thank you, I will try this procedure!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2023 19:35:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3604095#M1890</guid>
      <dc:creator>fabricator1</dc:creator>
      <dc:date>2023-12-27T19:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: Add or remove column in Lakehouse table</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3604118#M1891</link>
      <description>&lt;P&gt;Thanks for the reply&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/664218"&gt;@fabricator1&lt;/a&gt;&amp;nbsp;. Please do let me know if the work around helped you. Do let me know if you have any further questions.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2023 19:45:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3604118#M1891</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-12-27T19:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Add or remove column in Lakehouse table</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3610717#M1892</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/664218"&gt;@fabricator1&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. Otherwise, will respond back with the more details and we will try to help. &lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 10:30:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3610717#M1892</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-02T10:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Add or remove column in Lakehouse table</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3610962#M1893</link>
      <description>&lt;P&gt;I didn't have the time to try this procedure. I started on it, and one thing I noticed was that when creating a table using Notebook, the table name can only have small letters. I guess that's normal.&lt;BR /&gt;&lt;BR /&gt;I had created the original table using Dataflows Gen 2, and the table name had capital letters.&lt;BR /&gt;&lt;BR /&gt;Anyway I decided to delete the table and recreate the table using Dataflows Gen 2. For my current purpose, that was okay.&lt;BR /&gt;&lt;BR /&gt;I hope there will be a feature to add or remove columns in a Lakehouse table without having to delete and recreate the table. I created it as an idea:&amp;nbsp;&lt;A href="https://ideas.fabric.microsoft.com/ideas/idea/?ideaid=746601c5-6ba9-ee11-92bd-6045bdb0416e" target="_blank"&gt;Microsoft Idea&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 12:40:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3610962#M1893</guid>
      <dc:creator>fabricator1</dc:creator>
      <dc:date>2024-01-02T12:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: Add or remove column in Lakehouse table</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3611274#M1894</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/664218"&gt;@fabricator1&lt;/a&gt;&amp;nbsp;, not sure if this helps with your particular scenrio but you could try the column mapping feature which allows you to alter/drop/add columns in a Lakehouse table by following this (it's databricks but it works in Fabric too).&amp;nbsp; It's a one way operation on the table itself and can't be reversed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/en/delta/delta-column-mapping.html" target="_blank"&gt;Rename and drop columns with Delta Lake column mapping | Databricks on AWS&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndyDDC_0-1704208039372.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1018831iFE1C8EF35278EF74/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndyDDC_0-1704208039372.png" alt="AndyDDC_0-1704208039372.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 15:08:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3611274#M1894</guid>
      <dc:creator>AndyDDC</dc:creator>
      <dc:date>2024-01-02T15:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: Add or remove column in Lakehouse table</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3611360#M1895</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/265587"&gt;@AndyDDC&lt;/a&gt;,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This was my original approach, however after I did that I wasn't able to use the table in the SQL Analytics Endpoint and Power BI semantic model.&lt;BR /&gt;I guess that's what's mentioned here:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fabricator1_0-1704210535405.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1018854i1AA1DD4F2E3F96E2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fabricator1_0-1704210535405.png" alt="fabricator1_0-1704210535405.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Is it working on your side after making such changes?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 15:50:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3611360#M1895</guid>
      <dc:creator>fabricator1</dc:creator>
      <dc:date>2024-01-02T15:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Add or remove column in Lakehouse table</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3611400#M1896</link>
      <description>&lt;P&gt;Ah OK, no the meta-data sync will not work for the SQL Endpoint/Semantic Model unfortunately.&amp;nbsp; I've used the above approach for a raw lakehouse layer (proof of concept) which did not require sql endpoint/semantic model&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 16:12:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/3611400#M1896</guid>
      <dc:creator>AndyDDC</dc:creator>
      <dc:date>2024-01-02T16:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Add or remove column in Lakehouse table</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/4232381#M4475</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;that made no sense to me.&lt;BR /&gt;You mention the table list with the column named "genre"&lt;BR /&gt;1. Then you run code to drop a column - not "genre" but "id" and create a new table list1&lt;/P&gt;&lt;P&gt;2. Then delete the table list&lt;/P&gt;&lt;P&gt;3. Then run same code you ran in step 1 - including the df = df.drop("id") line??&lt;BR /&gt;4. Then you show a table list which includes the "id" column but not the "genre" column.&lt;BR /&gt;&lt;BR /&gt;I have to assume you meant in step 1 that the column name you deleted should be "genre" and not "id".&lt;BR /&gt;If so, then it makes sense -- all except you including the&amp;nbsp;df = df.drop("&amp;lt;column&amp;gt;") line in your code. Why would you include that and not just the SELECT * and df.write.format code lines?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 18:59:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/4232381#M4475</guid>
      <dc:creator>MJ_Taft</dc:creator>
      <dc:date>2024-10-07T18:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: Add or remove column in Lakehouse table</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/4358476#M6014</link>
      <description>&lt;P&gt;import pyspark.sql.functions as F&lt;BR /&gt;from delta.tables import *&lt;/P&gt;&lt;P&gt;# Load the table&lt;BR /&gt;df = spark.sql("SELECT * FROM SparkNotebook.retail2_table")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Drop unwanted columns (replace 'column_name1', 'column_name2' with actual column names you want to remove)&lt;BR /&gt;columns_to_remove = ['column_name1', 'column_name2']&lt;BR /&gt;df_first_10 = df_first_10.drop(*columns_to_remove)&lt;/P&gt;&lt;P&gt;# Overwrite the existing Delta table with the first 10 rows (with the removed columns)&lt;BR /&gt;df_first_10.write.format("delta").mode("overwrite").saveAsTable("SparkNotebook.retail2_table")&lt;BR /&gt;&lt;BR /&gt;this code will help to remvoe likely columns.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 08:48:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Add-or-remove-column-in-Lakehouse-table/m-p/4358476#M6014</guid>
      <dc:creator>sdrfghjkl</dc:creator>
      <dc:date>2025-01-10T08:48:33Z</dc:date>
    </item>
  </channel>
</rss>

