<?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: Adding new columns to a Delta Live table in a CDC process in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/adding-new-columns-to-a-delta-live-table-in-a-cdc-process/m-p/76354#M35205</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/109711"&gt;@ameya&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Scenario 1: Enabling&amp;nbsp;&lt;A href="https://docs.databricks.com/en/delta/update-schema.html#enable-schema-evolution" target="_self"&gt;Delta schema evolution&lt;/A&gt;&amp;nbsp;in your table or at DLT pipeline level should suffice for the scenario of new fields being added to the schema.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Scenario 2: The INSERT statement doesn't support schema evolution as described in&amp;nbsp;&lt;A href="https://docs.databricks.com/en/delta/update-schema.html#enable-schema-evolution" target="_self"&gt;Delta schema evolution&lt;/A&gt;. You can explore the &lt;A href="https://docs.databricks.com/en/sql/language-manual/delta-merge-into.html" target="_blank"&gt;MERGE INTO&lt;/A&gt; statement for INSERT/UPDATE scenarios, merges will support schema evolution but I believe there is no way to set different schemas based on the underlying operation.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jul 2024 17:39:29 GMT</pubDate>
    <dc:creator>raphaelblg</dc:creator>
    <dc:date>2024-07-01T17:39:29Z</dc:date>
    <item>
      <title>Adding new columns to a Delta Live table in a CDC process</title>
      <link>https://community.databricks.com/t5/data-engineering/adding-new-columns-to-a-delta-live-table-in-a-cdc-process/m-p/75898#M35093</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to databricks and still learning.&lt;/P&gt;&lt;P&gt;I am trying to do a CDC on a table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;APPLY CHANGES INTO LIVE.table1
FROM schema2.table2
KEYS (Id)
SEQUENCE BY orderByColumn
COLUMNS * EXCEPT (col1, col2)
  STORED AS SCD TYPE 1 ;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;table1 is in schema1 and is silver layer. table2 is in schema2 and is bronze layer.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;table2 may have different, new columns than table1. how do I insert or update these new columns into table1. I am assuming that would give us schema mismatch errors.&lt;/LI&gt;&lt;LI&gt;I want to insert some new columns based on the whether the operation is an insert operation or an update operation. If it is an update operation, I want to insert a column called 'LastModifiedDate' with the current timestamp and if it is an insert operation I want to insert a column called 'CreatedDate' as current timestamp.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;How can I do these 2 things?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 21:46:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/adding-new-columns-to-a-delta-live-table-in-a-cdc-process/m-p/75898#M35093</guid>
      <dc:creator>ameya</dc:creator>
      <dc:date>2024-06-26T21:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: Adding new columns to a Delta Live table in a CDC process</title>
      <link>https://community.databricks.com/t5/data-engineering/adding-new-columns-to-a-delta-live-table-in-a-cdc-process/m-p/76354#M35205</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/109711"&gt;@ameya&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Scenario 1: Enabling&amp;nbsp;&lt;A href="https://docs.databricks.com/en/delta/update-schema.html#enable-schema-evolution" target="_self"&gt;Delta schema evolution&lt;/A&gt;&amp;nbsp;in your table or at DLT pipeline level should suffice for the scenario of new fields being added to the schema.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Scenario 2: The INSERT statement doesn't support schema evolution as described in&amp;nbsp;&lt;A href="https://docs.databricks.com/en/delta/update-schema.html#enable-schema-evolution" target="_self"&gt;Delta schema evolution&lt;/A&gt;. You can explore the &lt;A href="https://docs.databricks.com/en/sql/language-manual/delta-merge-into.html" target="_blank"&gt;MERGE INTO&lt;/A&gt; statement for INSERT/UPDATE scenarios, merges will support schema evolution but I believe there is no way to set different schemas based on the underlying operation.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 17:39:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/adding-new-columns-to-a-delta-live-table-in-a-cdc-process/m-p/76354#M35205</guid>
      <dc:creator>raphaelblg</dc:creator>
      <dc:date>2024-07-01T17:39:29Z</dc:date>
    </item>
  </channel>
</rss>

