<?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: Change schema when writing to the Delta format in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/change-schema-when-writing-to-the-delta-format/m-p/31098#M22620</link>
    <description>&lt;P&gt;Hi @Mike Biber​,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just a friendly follow-up. Did Hubert's response helped you? Let us know if you still need help. &lt;/P&gt;</description>
    <pubDate>Mon, 03 Oct 2022 18:22:11 GMT</pubDate>
    <dc:creator>jose_gonzalez</dc:creator>
    <dc:date>2022-10-03T18:22:11Z</dc:date>
    <item>
      <title>Change schema when writing to the Delta format</title>
      <link>https://community.databricks.com/t5/data-engineering/change-schema-when-writing-to-the-delta-format/m-p/31096#M22618</link>
      <description>&lt;P&gt;Is it possible to reapply schema in delta files? For example, we have a history with field string but from some point, we need to replace string with struct.&lt;/P&gt;&lt;P&gt;In my case merge option and overwrite schema don't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 11:54:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/change-schema-when-writing-to-the-delta-format/m-p/31096#M22618</guid>
      <dc:creator>Justine_Bieber</dc:creator>
      <dc:date>2022-09-22T11:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Change schema when writing to the Delta format</title>
      <link>https://community.databricks.com/t5/data-engineering/change-schema-when-writing-to-the-delta-format/m-p/31097#M22619</link>
      <description>&lt;P&gt;You can change a column’s type or name or drop a column by &lt;B&gt;rewriting &lt;/B&gt;the table. To do this, use the&lt;/P&gt;&lt;P&gt;overwriteSchema option. But please back up your table first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;spark.read.table("table_name") \
.write \
.format("delta") \
.mode("overwrite") \
.option("overwriteSchema", "true") \
.saveAsTable("table_name")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 12:18:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/change-schema-when-writing-to-the-delta-format/m-p/31097#M22619</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-09-22T12:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: Change schema when writing to the Delta format</title>
      <link>https://community.databricks.com/t5/data-engineering/change-schema-when-writing-to-the-delta-format/m-p/31098#M22620</link>
      <description>&lt;P&gt;Hi @Mike Biber​,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just a friendly follow-up. Did Hubert's response helped you? Let us know if you still need help. &lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 18:22:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/change-schema-when-writing-to-the-delta-format/m-p/31098#M22620</guid>
      <dc:creator>jose_gonzalez</dc:creator>
      <dc:date>2022-10-03T18:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Change schema when writing to the Delta format</title>
      <link>https://community.databricks.com/t5/data-engineering/change-schema-when-writing-to-the-delta-format/m-p/31099#M22621</link>
      <description>&lt;P&gt;Hi guys! &lt;/P&gt;&lt;P&gt;Definitely, thank you for your support.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Oct 2022 15:06:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/change-schema-when-writing-to-the-delta-format/m-p/31099#M22621</guid>
      <dc:creator>Justine_Bieber</dc:creator>
      <dc:date>2022-10-09T15:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Change schema when writing to the Delta format</title>
      <link>https://community.databricks.com/t5/data-engineering/change-schema-when-writing-to-the-delta-format/m-p/31100#M22622</link>
      <description>&lt;P&gt;Please select my answer as the best one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the last updates, it is also possible to rename columns using ALTER, but only when mapping is enabled. Check here &lt;A href="https://docs.databricks.com/delta/delta-column-mapping.html" target="test_blank"&gt;https://docs.databricks.com/delta/delta-column-mapping.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Oct 2022 16:15:13 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/change-schema-when-writing-to-the-delta-format/m-p/31100#M22622</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-10-16T16:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Change schema when writing to the Delta format</title>
      <link>https://community.databricks.com/t5/data-engineering/change-schema-when-writing-to-the-delta-format/m-p/31101#M22623</link>
      <description>&lt;P&gt;Hi @Hubert Dudek​. Do you know if this works also for identity columns? Is there another way to do this? The below returns ParseException. Thank you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tt = spark.read.table("table_name") \&lt;/P&gt;&lt;P&gt;.withColumn("ID",col("ID").cast("&lt;B&gt;&lt;U&gt;BIGINT GENERATED ALWAYS&lt;/U&gt;&lt;/B&gt;")) \&lt;/P&gt;&lt;P&gt;.write \&lt;/P&gt;&lt;P&gt;.format("delta") \&lt;/P&gt;&lt;P&gt;.mode("overwrite") \&lt;/P&gt;&lt;P&gt;.option("overwriteSchema", "true") \&lt;/P&gt;&lt;P&gt;.saveAsTable("table_name")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2022 10:32:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/change-schema-when-writing-to-the-delta-format/m-p/31101#M22623</guid>
      <dc:creator>elgeo</dc:creator>
      <dc:date>2022-11-11T10:32:35Z</dc:date>
    </item>
  </channel>
</rss>

