<?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 urgent: apply changes into delta live tables in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/urgent-apply-changes-into-delta-live-tables/m-p/53824#M29889</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/9"&gt;@Retired_mod&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/46052"&gt;@Avnish_Jain&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I implement cdc in sql dlt pipelines with a live table (not streaming) . I am trying to implement below where i am reading from external tables, loading data into bronze layer and then want to apply these changes into silver table but I am getting error with the apply changes into syntax.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;create
or refresh live table bronze_dtl (
  name string,
  age string,
  trk_nbr string,
  perd_nbr string,
  ld_timestamp timestamp
) comment "raw data" tblproperties (
  'quality' = 'silver',
  'delta.enableChangeDataFeed' = 'true'
) partitioned by (perd_nbr) as (
  select 
  name,
  age,
  trk_nbr,
  perd_nbr,
  current_timestamp() as ld_timestamp
);

create
or refresh live table silver_dtl (
  name string,
  age string,
  trk_nbr string,
  perd_nbr string,
  ld_timestamp timestamp
) comment "curated data" tblproperties (
  'quality' = 'silver',
  'delta.enableChangeDataFeed' = 'true'
) partitioned by (perd_nbr);

apply changes into live.silver_dtl
from
  live.bronze_dtl keys (trk_nbr, perd_nbr) sequence by ld_timestamp stored as scd type 1;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Please let me know wheres the issue, and any shortcomings in the above example specifically in cdc part&lt;/P&gt;</description>
    <pubDate>Sat, 25 Nov 2023 11:09:58 GMT</pubDate>
    <dc:creator>Faisal</dc:creator>
    <dc:date>2023-11-25T11:09:58Z</dc:date>
    <item>
      <title>urgent: apply changes into delta live tables</title>
      <link>https://community.databricks.com/t5/data-engineering/urgent-apply-changes-into-delta-live-tables/m-p/53824#M29889</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/9"&gt;@Retired_mod&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/46052"&gt;@Avnish_Jain&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I implement cdc in sql dlt pipelines with a live table (not streaming) . I am trying to implement below where i am reading from external tables, loading data into bronze layer and then want to apply these changes into silver table but I am getting error with the apply changes into syntax.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;create
or refresh live table bronze_dtl (
  name string,
  age string,
  trk_nbr string,
  perd_nbr string,
  ld_timestamp timestamp
) comment "raw data" tblproperties (
  'quality' = 'silver',
  'delta.enableChangeDataFeed' = 'true'
) partitioned by (perd_nbr) as (
  select 
  name,
  age,
  trk_nbr,
  perd_nbr,
  current_timestamp() as ld_timestamp
);

create
or refresh live table silver_dtl (
  name string,
  age string,
  trk_nbr string,
  perd_nbr string,
  ld_timestamp timestamp
) comment "curated data" tblproperties (
  'quality' = 'silver',
  'delta.enableChangeDataFeed' = 'true'
) partitioned by (perd_nbr);

apply changes into live.silver_dtl
from
  live.bronze_dtl keys (trk_nbr, perd_nbr) sequence by ld_timestamp stored as scd type 1;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Please let me know wheres the issue, and any shortcomings in the above example specifically in cdc part&lt;/P&gt;</description>
      <pubDate>Sat, 25 Nov 2023 11:09:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/urgent-apply-changes-into-delta-live-tables/m-p/53824#M29889</guid>
      <dc:creator>Faisal</dc:creator>
      <dc:date>2023-11-25T11:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: urgent: apply changes into delta live tables</title>
      <link>https://community.databricks.com/t5/data-engineering/urgent-apply-changes-into-delta-live-tables/m-p/53831#M29894</link>
      <description>&lt;P&gt;Below is the error I am getting, I am extracting data using queries into a live table (MV) and then intend to use it to merge changes into a streaming silver table, need to know the correct approach, the official documentation is unclear&lt;BR /&gt;&lt;BR /&gt;Error details&lt;BR /&gt;org.apache.spark.sql.streaming.StreamingQueryException: [STREAM_FAILED] Query terminated with exception: Detected a data update in the source table at version 3. This is currently not supported. If you'd like to ignore updates, set the option 'skipChangeCommits' to 'true'. If you would like the data update to be reflected, please restart this query with a fresh checkpoint directory.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Nov 2023 16:51:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/urgent-apply-changes-into-delta-live-tables/m-p/53831#M29894</guid>
      <dc:creator>Faisal</dc:creator>
      <dc:date>2023-11-25T16:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: urgent: apply changes into delta live tables</title>
      <link>https://community.databricks.com/t5/data-engineering/urgent-apply-changes-into-delta-live-tables/m-p/54429#M30075</link>
      <description>&lt;P&gt;Hi Faisal, can you please elaborate on the reason why the &lt;FONT face="courier new,courier"&gt;bronze_dtl&lt;/FONT&gt; table is a live table and not a streaming live table?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 10:21:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/urgent-apply-changes-into-delta-live-tables/m-p/54429#M30075</guid>
      <dc:creator>Avnish_Jain</dc:creator>
      <dc:date>2023-12-01T10:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: urgent: apply changes into delta live tables</title>
      <link>https://community.databricks.com/t5/data-engineering/urgent-apply-changes-into-delta-live-tables/m-p/55982#M30480</link>
      <description>&lt;P&gt;reason being data at source is subject to restatements and ST is not allowing to merge changes using appl changes into&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jan 2024 04:13:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/urgent-apply-changes-into-delta-live-tables/m-p/55982#M30480</guid>
      <dc:creator>Faisal</dc:creator>
      <dc:date>2024-01-01T04:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: urgent: apply changes into delta live tables</title>
      <link>https://community.databricks.com/t5/data-engineering/urgent-apply-changes-into-delta-live-tables/m-p/56078#M30503</link>
      <description>&lt;P&gt;Hi Faisal,&amp;nbsp;&lt;FONT face="courier new,courier"&gt;APPLY CHANGES INTO&lt;/FONT&gt;&amp;nbsp;does not support a materialized view as a source, this must be a streaming table.&lt;/P&gt;
&lt;P&gt;Ideally, your bronze tables are append-only with the source providing data incrementally. If you do get revisions on previous records in your data, then these should be appended as separate rows into your bronze table which you can then use &lt;FONT face="courier new,courier"&gt;APPLY CHANGES INTO&lt;/FONT&gt; your silver role to maintain the accurate/most-up-to date version of a record.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;For example:&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Assume we have already received and ingested values for IDs 1-3, and Source receives changes for these records:&lt;/P&gt;
&lt;PRE&gt;ID,Value&lt;BR /&gt;1,Updated_V1&lt;BR /&gt;2,Updated_V2&lt;BR /&gt;3,Updated_V3&lt;/PRE&gt;
&lt;P&gt;Our Bronze table would look like:&lt;/P&gt;
&lt;PRE&gt;ID,Value,Insert_Ts,...&lt;BR /&gt;1,Old_V1,Some_Past_Date,...&lt;BR /&gt;2,Old_V2,Some_Past_Date,...&lt;BR /&gt;3,Old_V3,Some_Past_Date,...&lt;BR /&gt;4,Old_V4,Some_Past_Date,...&lt;BR /&gt;1,Updated_V1,Today_Date,...&lt;BR /&gt;2,Updated_V2,Today_Date,...&lt;BR /&gt;3,Updated_V3,Today_Date,...&lt;/PRE&gt;
&lt;P&gt;You can then use Apply Changes into the Silver table which will yield the below if using SCD 1.&lt;/P&gt;
&lt;PRE&gt;ID,Value,Insert_Ts,...&lt;BR /&gt;4,Old_V4,Some_Past_Date,...&lt;BR /&gt;1,Updated_V1,Today_Date,...&lt;BR /&gt;2,Updated_V2,Today_Date,...&lt;BR /&gt;3,Updated_V3,Today_Date,...&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 11:25:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/urgent-apply-changes-into-delta-live-tables/m-p/56078#M30503</guid>
      <dc:creator>Avnish_Jain</dc:creator>
      <dc:date>2024-01-02T11:25:28Z</dc:date>
    </item>
  </channel>
</rss>

