<?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: Schema Changes to External table in Data Governance</title>
    <link>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/57634#M1551</link>
    <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/95713"&gt;@Dp15&lt;/a&gt;&amp;nbsp; -&amp;nbsp; Please refer to the below illustration.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Considering a streaming pipeline from table A to table B&lt;/LI&gt;
&lt;LI&gt;Without column mapping:
&lt;OL&gt;
&lt;LI&gt;you can only ADD COLUMN on table A&lt;/LI&gt;
&lt;LI&gt;If&amp;nbsp;&lt;SPAN&gt;spark.databricks.delta.schema.autoMerge.enabled&lt;/SPAN&gt;&amp;nbsp;is&lt;A href="https://docs.databricks.com/en/delta/update-schema.html#automatic-schema-evolution-for-delta-lake-merge" target="_blank" rel="noopener noreferrer"&gt;&amp;nbsp;set&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Any addition of columns to A (say&amp;nbsp;&lt;SPAN&gt;c&lt;/SPAN&gt;&amp;nbsp;)would cause&amp;nbsp;&lt;SPAN&gt;c&lt;/SPAN&gt;&amp;nbsp;to be added to table B as well (assuming no transformation or filtering)&lt;/LI&gt;
&lt;LI&gt;This is considered&amp;nbsp;&lt;EM&gt;safe&lt;/EM&gt;&amp;nbsp;because adding column to a table won't cause data miss or duplication, e.g. a select * from table B now will just show nulls for all historical data in B&lt;/LI&gt;
&lt;LI&gt;If ^ is not set: the stream would fail anyway&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;LI&gt;With column mapping:
&lt;OL&gt;
&lt;LI&gt;For ADD COLUMN, same story. So when you use&amp;nbsp;&lt;SPAN&gt;schemaTrackingLocation&lt;/SPAN&gt;&amp;nbsp;and ADD COLUMN, we won't require you to enter the&amp;nbsp;&lt;SPAN&gt;allowDropOrRenameColumn&lt;/SPAN&gt;&amp;nbsp;SQL conf.&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Please refer to the below doc for additional details -&amp;nbsp;&lt;A href="https://docs.databricks.com/en/delta/delta-column-mapping.html#streaming-with-column-mapping-and-schema-changes" target="_blank"&gt;https://docs.databricks.com/en/delta/delta-column-mapping.html#streaming-with-column-mapping-and-schema-changes&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jan 2024 00:36:48 GMT</pubDate>
    <dc:creator>shan_chandra</dc:creator>
    <dc:date>2024-01-18T00:36:48Z</dc:date>
    <item>
      <title>Schema Changes to External table</title>
      <link>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/57614#M1549</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I have an external table which reads data from a S3 bucket. The s3 bucket is expected to get new files frequently. With some changes to the underlying schema. I used Refresh Table table command to load new files from the s3 location and it worked fine. But when there are schema changes, either addition or deletion, the refresh table is not working,&lt;/P&gt;&lt;P&gt;Is it possible to refresh the metadata of the external table when there are schema changes? Should I alter the table each time there are changes to the schema? Could someone please help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 18:36:14 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/57614#M1549</guid>
      <dc:creator>Dp15</dc:creator>
      <dc:date>2024-01-17T18:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Schema Changes to External table</title>
      <link>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/57634#M1551</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/95713"&gt;@Dp15&lt;/a&gt;&amp;nbsp; -&amp;nbsp; Please refer to the below illustration.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Considering a streaming pipeline from table A to table B&lt;/LI&gt;
&lt;LI&gt;Without column mapping:
&lt;OL&gt;
&lt;LI&gt;you can only ADD COLUMN on table A&lt;/LI&gt;
&lt;LI&gt;If&amp;nbsp;&lt;SPAN&gt;spark.databricks.delta.schema.autoMerge.enabled&lt;/SPAN&gt;&amp;nbsp;is&lt;A href="https://docs.databricks.com/en/delta/update-schema.html#automatic-schema-evolution-for-delta-lake-merge" target="_blank" rel="noopener noreferrer"&gt;&amp;nbsp;set&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Any addition of columns to A (say&amp;nbsp;&lt;SPAN&gt;c&lt;/SPAN&gt;&amp;nbsp;)would cause&amp;nbsp;&lt;SPAN&gt;c&lt;/SPAN&gt;&amp;nbsp;to be added to table B as well (assuming no transformation or filtering)&lt;/LI&gt;
&lt;LI&gt;This is considered&amp;nbsp;&lt;EM&gt;safe&lt;/EM&gt;&amp;nbsp;because adding column to a table won't cause data miss or duplication, e.g. a select * from table B now will just show nulls for all historical data in B&lt;/LI&gt;
&lt;LI&gt;If ^ is not set: the stream would fail anyway&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;LI&gt;With column mapping:
&lt;OL&gt;
&lt;LI&gt;For ADD COLUMN, same story. So when you use&amp;nbsp;&lt;SPAN&gt;schemaTrackingLocation&lt;/SPAN&gt;&amp;nbsp;and ADD COLUMN, we won't require you to enter the&amp;nbsp;&lt;SPAN&gt;allowDropOrRenameColumn&lt;/SPAN&gt;&amp;nbsp;SQL conf.&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Please refer to the below doc for additional details -&amp;nbsp;&lt;A href="https://docs.databricks.com/en/delta/delta-column-mapping.html#streaming-with-column-mapping-and-schema-changes" target="_blank"&gt;https://docs.databricks.com/en/delta/delta-column-mapping.html#streaming-with-column-mapping-and-schema-changes&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 00:36:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/57634#M1551</guid>
      <dc:creator>shan_chandra</dc:creator>
      <dc:date>2024-01-18T00:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: Schema Changes to External table</title>
      <link>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/57778#M1559</link>
      <description>&lt;P&gt;HI &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/616"&gt;@shan_chandra&lt;/a&gt;&amp;nbsp;how about deletions from the external location? And what if I am not using a streaming table?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 15:18:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/57778#M1559</guid>
      <dc:creator>Dp15</dc:creator>
      <dc:date>2024-01-18T15:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: Schema Changes to External table</title>
      <link>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/57791#M1560</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/95713"&gt;@Dp15&lt;/a&gt;&amp;nbsp;- you can drop column manually using the below&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ALTER TABLE table_name DROP COLUMN col_name&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;1. Please note dropping a column from a metadata does not delete the underlying data for column in files. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. Purging the data column can be done using&amp;nbsp;&lt;/SPAN&gt;&lt;A class="reference internal" href="https://docs.databricks.com/en/sql/language-manual/delta-reorg-table.html" target="_blank"&gt;&lt;SPAN class="doc"&gt;REORG TABLE&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;to rewrite files. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3. Use&amp;nbsp;&lt;/SPAN&gt;&lt;A class="reference internal" href="https://docs.databricks.com/en/sql/language-manual/delta-vacuum.html" target="_blank"&gt;&lt;SPAN class="doc"&gt;VACUUM&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;to physically delete the files that contain the dropped column data.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Reference:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.databricks.com/en/delta/delta-column-mapping.html#drop-columns" target="_blank"&gt;https://docs.databricks.com/en/delta/delta-column-mapping.html#drop-columns&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.databricks.com/en/delta/update-schema.html#explicitly-update-schema-to-drop-columns" target="_blank"&gt;https://docs.databricks.com/en/delta/update-schema.html#explicitly-update-schema-to-drop-columns&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 16:29:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/57791#M1560</guid>
      <dc:creator>shan_chandra</dc:creator>
      <dc:date>2024-01-18T16:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: Schema Changes to External table</title>
      <link>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/57844#M1562</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/616"&gt;@shan_chandra&lt;/a&gt;&amp;nbsp;This drop works for a delta table which is managed table, however it does work for an external table, I am looking specifically for schema changes in external table, now a&amp;nbsp; refresh might work to load new metadata in the external table, however when there are schema modifications, only addition of columns are possible dropping a column has not worked for me, Correct me if I am wrong here&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 21:27:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/57844#M1562</guid>
      <dc:creator>Dp15</dc:creator>
      <dc:date>2024-01-18T21:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Schema Changes to External table</title>
      <link>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/57900#M1564</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/95713"&gt;@Dp15&lt;/a&gt;&amp;nbsp;- yes you are correct.&amp;nbsp;&lt;SPAN&gt;Dropping a column from an managed table in Databricks works different from the external table(as the schema is inferred by the underlying source). Below hack can help. AFAIK. Please let me know if this works for you.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;1. create or replace new external table B on the new schema (new set of columns you want to keep) and new data source path
2. insert into new table B as select (required columns) from table A(old table). 
3. Drop table A 
4. Alter table - Rename table B to table A&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 19 Jan 2024 17:10:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/57900#M1564</guid>
      <dc:creator>shan_chandra</dc:creator>
      <dc:date>2024-01-19T17:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: Schema Changes to External table</title>
      <link>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/58278#M1568</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/616"&gt;@shan_chandra&lt;/a&gt;&amp;nbsp;This worked thank you&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 15:38:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/58278#M1568</guid>
      <dc:creator>Dp15</dc:creator>
      <dc:date>2024-01-23T15:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Schema Changes to External table</title>
      <link>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/58280#M1569</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/95713"&gt;@Dp15&lt;/a&gt;&amp;nbsp;- I am glad it worked. Happy to help!!!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 15:48:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-governance/schema-changes-to-external-table/m-p/58280#M1569</guid>
      <dc:creator>shan_chandra</dc:creator>
      <dc:date>2024-01-23T15:48:55Z</dc:date>
    </item>
  </channel>
</rss>

