<?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: delete and append in delta path in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/delete-and-append-in-delta-path/m-p/13166#M7880</link>
    <description>&lt;P&gt;Yes, Delta is ACID, so it should work ok. As an alternative, you can always consider MERGE (as I bet that you want to replace Dates that are coming with updates)&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/delta-merge-into" target="test_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/delta-merge-into&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 07 Jan 2023 12:33:11 GMT</pubDate>
    <dc:creator>Hubert-Dudek</dc:creator>
    <dc:date>2023-01-07T12:33:11Z</dc:date>
    <item>
      <title>delete and append in delta path</title>
      <link>https://community.databricks.com/t5/data-engineering/delete-and-append-in-delta-path/m-p/13165#M7879</link>
      <description>&lt;P&gt;I am deleting data from curated path based on date column and appending staged data on it on each run, using below script. My fear is, just after the delete operation, if any network issue appeared and the job stopped before it appended the staged data on curated_path. How does the delta lake (The ACID property) handles this situation, does this roll back to the previous state since it did not append the staged data?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR how to do delete and append properly in delta lake to avoide any data loss? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;df_curated = spark.read.format('delta').load(curated_path)&lt;/P&gt;&lt;P&gt;df_curated.createOrReplaceTempView("curated_view")&lt;/P&gt;&lt;P&gt;sqlString = "DELETE FROM curated_view WHERE Date &amp;gt;= "+"'{}'" .format(daysback_date)&lt;/P&gt;&lt;P&gt;spark.sql(sqlString)&lt;/P&gt;&lt;P&gt;df_staged.write.partitionBy("Year").format('delta').mode("append").save(curated_path)&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jan 2023 04:43:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/delete-and-append-in-delta-path/m-p/13165#M7879</guid>
      <dc:creator>KKo</dc:creator>
      <dc:date>2023-01-07T04:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: delete and append in delta path</title>
      <link>https://community.databricks.com/t5/data-engineering/delete-and-append-in-delta-path/m-p/13166#M7880</link>
      <description>&lt;P&gt;Yes, Delta is ACID, so it should work ok. As an alternative, you can always consider MERGE (as I bet that you want to replace Dates that are coming with updates)&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/delta-merge-into" target="test_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/delta-merge-into&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jan 2023 12:33:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/delete-and-append-in-delta-path/m-p/13166#M7880</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2023-01-07T12:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: delete and append in delta path</title>
      <link>https://community.databricks.com/t5/data-engineering/delete-and-append-in-delta-path/m-p/13167#M7881</link>
      <description>&lt;P&gt;thanks man&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jan 2023 16:01:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/delete-and-append-in-delta-path/m-p/13167#M7881</guid>
      <dc:creator>Aviral-Bhardwaj</dc:creator>
      <dc:date>2023-01-07T16:01:02Z</dc:date>
    </item>
  </channel>
</rss>

