<?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: merge into deletes from SOURCE in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/merge-into-deletes-from-source/m-p/4448#M1177</link>
    <description>&lt;P&gt;It should work the same whether it is a view of a table. But I am confused on how it was deleting data from a view. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In any case, happy this is resolved! And you are unblocked. If you believe there is a bug please provide more details on how we can replicate the issue and we can look into it. &lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 16:44:34 GMT</pubDate>
    <dc:creator>Ryan_Chynoweth</dc:creator>
    <dc:date>2023-06-09T16:44:34Z</dc:date>
    <item>
      <title>merge into deletes from SOURCE</title>
      <link>https://community.databricks.com/t5/data-engineering/merge-into-deletes-from-source/m-p/4445#M1174</link>
      <description>&lt;P&gt;I&amp;nbsp;am using the following query to make an upsert:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;MERGE INTO my_target_table AS target
USING (SELECT MAX(__my_timestamp) AS checkpoint FROM my_source_table) AS source
  ON target.name = 'some_name'
  AND target.address = 'some_address'
WHEN MATCHED AND source.checkpoint IS NOT NULL THEN
  UPDATE SET checkpoint = source.checkpoint
WHEN NOT MATCHED THEN
  INSERT (name, address, checkpoint)
  VALUES ('some_name', 'some_address', source.checkpoint)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whenever it does 'insert', it also deletes from *my_source_table*. Any explanation why it deletes from *my_source_table* and can I avoid it, so the logic will stay the same, without anything being deleted from the source&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 20:42:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/merge-into-deletes-from-source/m-p/4445#M1174</guid>
      <dc:creator>gilo12</dc:creator>
      <dc:date>2023-05-12T20:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: merge into deletes from SOURCE</title>
      <link>https://community.databricks.com/t5/data-engineering/merge-into-deletes-from-source/m-p/4446#M1175</link>
      <description>&lt;P&gt;Can you provide the table history of your source table? Your logic appears correct. The source history should tell us if a delete is actually happening. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or at least a before and after state of your table &lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 21:36:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/merge-into-deletes-from-source/m-p/4446#M1175</guid>
      <dc:creator>Ryan_Chynoweth</dc:creator>
      <dc:date>2023-05-12T21:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: merge into deletes from SOURCE</title>
      <link>https://community.databricks.com/t5/data-engineering/merge-into-deletes-from-source/m-p/4447#M1176</link>
      <description>&lt;P&gt;I was using a &lt;I&gt;view&lt;/I&gt; for my_source_table, once I changed that to be a &lt;I&gt;table&lt;/I&gt; the issue stoped.&lt;/P&gt;&lt;P&gt;That unblocked me, but I think Databricks has a bug with using MERGE INTO from a VIEW&lt;/P&gt;</description>
      <pubDate>Sat, 13 May 2023 01:46:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/merge-into-deletes-from-source/m-p/4447#M1176</guid>
      <dc:creator>gilo12</dc:creator>
      <dc:date>2023-05-13T01:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: merge into deletes from SOURCE</title>
      <link>https://community.databricks.com/t5/data-engineering/merge-into-deletes-from-source/m-p/4448#M1177</link>
      <description>&lt;P&gt;It should work the same whether it is a view of a table. But I am confused on how it was deleting data from a view. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In any case, happy this is resolved! And you are unblocked. If you believe there is a bug please provide more details on how we can replicate the issue and we can look into it. &lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:44:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/merge-into-deletes-from-source/m-p/4448#M1177</guid>
      <dc:creator>Ryan_Chynoweth</dc:creator>
      <dc:date>2023-06-09T16:44:34Z</dc:date>
    </item>
  </channel>
</rss>

