<?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: How to add the partition for an existing delta table in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-add-the-partition-for-an-existing-delta-table/m-p/27335#M19212</link>
    <description>&lt;P&gt;Updated the description&lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2022 11:50:33 GMT</pubDate>
    <dc:creator>hari</dc:creator>
    <dc:date>2022-10-18T11:50:33Z</dc:date>
    <item>
      <title>How to add the partition for an existing delta table</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-add-the-partition-for-an-existing-delta-table/m-p/27333#M19210</link>
      <description>&lt;P&gt;We didn't need to set partitions for our delta tables as we didn't have many performance concerns and delta lake out-of-the-box optimization worked great for us. But there is now a need to set a specific partition column for some tables to allow concurrent delta merges into the partitions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are using unmanaged tables with the data sitting in s3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the best way to add/update partition columns on an existing delta table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried the `&lt;B&gt;ALTER&lt;/B&gt; &lt;B&gt;TABLE&lt;/B&gt; log &lt;B&gt;ADD&lt;/B&gt; PARTITION(date = DATE'2021-09-10');` but it didn't work also this doesn't add partition for all values of date&lt;/P&gt;&lt;P&gt;Also tried rewriting the table and setting partition column with:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;(
df.write.format("delta")
.mode("overwrite")
.option("overwriteSchema", "true")
 .partitionBy(&amp;lt;Col Name&amp;gt;)
 .saveAsTable(&amp;lt;Table Name&amp;gt;)
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But I don't see the partition name when I check the table with `DESCRIBE TABLE`, So not sure if this is the proper way to approach this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another option is to recreate the tables as i do see that we can set partition columns while creating a table, But don't really want to do this except maybe as a last resort.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 13:07:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-add-the-partition-for-an-existing-delta-table/m-p/27333#M19210</guid>
      <dc:creator>hari</dc:creator>
      <dc:date>2022-10-14T13:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to add the partition for an existing delta table</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-add-the-partition-for-an-existing-delta-table/m-p/27335#M19212</link>
      <description>&lt;P&gt;Updated the description&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 11:50:33 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-add-the-partition-for-an-existing-delta-table/m-p/27335#M19212</guid>
      <dc:creator>hari</dc:creator>
      <dc:date>2022-10-18T11:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to add the partition for an existing delta table</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-add-the-partition-for-an-existing-delta-table/m-p/27336#M19213</link>
      <description>&lt;P&gt;Just read it and save it partitioned under the same name. But please back up first!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 12:24:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-add-the-partition-for-an-existing-delta-table/m-p/27336#M19213</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-10-20T12:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to add the partition for an existing delta table</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-add-the-partition-for-an-existing-delta-table/m-p/27338#M19215</link>
      <description>&lt;P&gt;Hi @Hubert Dudek​&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, the only way is to read the entire data repartition and then write, correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Will this add a new partition if a new value for the partition key comes&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 05:12:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-add-the-partition-for-an-existing-delta-table/m-p/27338#M19215</guid>
      <dc:creator>hari</dc:creator>
      <dc:date>2022-10-21T05:12:43Z</dc:date>
    </item>
  </channel>
</rss>

