<?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: DLT apply_changes not accepting upsert in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/dlt-apply-changes-not-accepting-upsert/m-p/99639#M40054</link>
    <description>&lt;P&gt;You obtain this error: "Detected a data update in the source table at version 1. This is currently not supported...."&lt;BR /&gt;becuse DLT is based on Structured Streaming.... and for Structured Streaming any changes (deletes, updates) in the source table are not allowed (by default of course).&lt;/P&gt;&lt;P&gt;Your understanding is wrong. If you use this option skipChangeCommits your 'streaming task' won't broke because of changes in the source table.&lt;/P&gt;&lt;P&gt;Please read carefull at previously posted link:&lt;/P&gt;&lt;P&gt;"By default, streaming tables require append-only sources. When a streaming table uses another streaming table as a source, and the source streaming table requires updates or deletes, for example, GDPR “right to be forgotten” processing, the &lt;SPAN class=""&gt;skipChangeCommits&lt;/SPAN&gt; flag can be set when reading the source streaming table to ignore those changes. For more information about this flag, see &lt;A class="" href="https://docs.databricks.com/en/structured-streaming/delta-lake.html#ignore-changes" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;Ignore updates and deletes&lt;/SPAN&gt;&lt;/A&gt;."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Nov 2024 14:49:57 GMT</pubDate>
    <dc:creator>Mike_Szklarczyk</dc:creator>
    <dc:date>2024-11-21T14:49:57Z</dc:date>
    <item>
      <title>DLT apply_changes not accepting upsert</title>
      <link>https://community.databricks.com/t5/data-engineering/dlt-apply-changes-not-accepting-upsert/m-p/99615#M40046</link>
      <description>&lt;P&gt;I have a DLT pipeline that has bronze -&amp;gt; silver -&amp;gt; gold -&amp;gt; platinum. I need to include a table that is joined to the gold layer for platinum that allows upserts in the DLT pipeline. This table is managed externally via Databricks API. Anytime a change is made in our UI, the table updates or includes new rows. I need to be able to support that in the DLT pipeline, which I read apply_changes allows for this functionality.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I implemented the apply_changes logic and see there are upserts supported but when I make an update to the table, I get an error saying: "&lt;SPAN&gt;Detected a data update in the source table at version 1. 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;/SPAN&gt;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/97035"&gt;@Dlt&lt;/a&gt;.view
def rules():
  return spark.readStream.table("table")

rule_groups_schema = StructType([
  StructField("id", StringType(), True),
  StructField("name", StringType(), True), 
  StructField("rules", ArrayType(StringType()), True),
  StructField("lastModifiedDate", TimestampType(), True)
])

dlt.create_streaming_table(
  name="rule_groups",
  comment="Target table for rule group updates",
  schema=rule_groups_schema)

dlt.apply_changes(
  target="rule_groups",
  source="rules",
  keys=["id"],
  sequence_by=col("lastModifiedDate"),
  stored_as_scd_type=1
)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 21 Nov 2024 13:39:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dlt-apply-changes-not-accepting-upsert/m-p/99615#M40046</guid>
      <dc:creator>rimaissa</dc:creator>
      <dc:date>2024-11-21T13:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: DLT apply_changes not accepting upsert</title>
      <link>https://community.databricks.com/t5/data-engineering/dlt-apply-changes-not-accepting-upsert/m-p/99624#M40048</link>
      <description>&lt;P&gt;Please try set up this option: skipChangeCommits&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/en/delta-live-tables/python-ref.html#configure-a-streaming-table-to-ignore-changes-in-a-source-streaming-table" target="_blank"&gt;https://docs.databricks.com/en/delta-live-tables/python-ref.html#configure-a-streaming-table-to-ignore-changes-in-a-source-streaming-table&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 14:07:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dlt-apply-changes-not-accepting-upsert/m-p/99624#M40048</guid>
      <dc:creator>Mike_Szklarczyk</dc:creator>
      <dc:date>2024-11-21T14:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: DLT apply_changes not accepting upsert</title>
      <link>https://community.databricks.com/t5/data-engineering/dlt-apply-changes-not-accepting-upsert/m-p/99628#M40050</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/116039"&gt;@Mike_Szklarczyk&lt;/a&gt;,&amp;nbsp;I want the changes to flow through though. My understanding is, if I add skipChangeCommits it will not process the upserts to the table.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 14:14:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dlt-apply-changes-not-accepting-upsert/m-p/99628#M40050</guid>
      <dc:creator>rimaissa</dc:creator>
      <dc:date>2024-11-21T14:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: DLT apply_changes not accepting upsert</title>
      <link>https://community.databricks.com/t5/data-engineering/dlt-apply-changes-not-accepting-upsert/m-p/99639#M40054</link>
      <description>&lt;P&gt;You obtain this error: "Detected a data update in the source table at version 1. This is currently not supported...."&lt;BR /&gt;becuse DLT is based on Structured Streaming.... and for Structured Streaming any changes (deletes, updates) in the source table are not allowed (by default of course).&lt;/P&gt;&lt;P&gt;Your understanding is wrong. If you use this option skipChangeCommits your 'streaming task' won't broke because of changes in the source table.&lt;/P&gt;&lt;P&gt;Please read carefull at previously posted link:&lt;/P&gt;&lt;P&gt;"By default, streaming tables require append-only sources. When a streaming table uses another streaming table as a source, and the source streaming table requires updates or deletes, for example, GDPR “right to be forgotten” processing, the &lt;SPAN class=""&gt;skipChangeCommits&lt;/SPAN&gt; flag can be set when reading the source streaming table to ignore those changes. For more information about this flag, see &lt;A class="" href="https://docs.databricks.com/en/structured-streaming/delta-lake.html#ignore-changes" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;Ignore updates and deletes&lt;/SPAN&gt;&lt;/A&gt;."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 14:49:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dlt-apply-changes-not-accepting-upsert/m-p/99639#M40054</guid>
      <dc:creator>Mike_Szklarczyk</dc:creator>
      <dc:date>2024-11-21T14:49:57Z</dc:date>
    </item>
  </channel>
</rss>

