<?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: Alter Delta table column datatype in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/alter-delta-table-column-datatype/m-p/12788#M7550</link>
    <description>&lt;P&gt;Hi @Hariharan Sambath​&amp;nbsp;Please check following document: &lt;A href="https://docs.databricks.com/spark/2.x/spark-sql/language-manual/alter-table-or-view.html#change-columns" target="test_blank"&gt;https://docs.databricks.com/spark/2.x/spark-sql/language-manual/alter-table-or-view.html#change-columns&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Aug 2022 21:02:27 GMT</pubDate>
    <dc:creator>Noopur_Nigam</dc:creator>
    <dc:date>2022-08-30T21:02:27Z</dc:date>
    <item>
      <title>Alter Delta table column datatype</title>
      <link>https://community.databricks.com/t5/data-engineering/alter-delta-table-column-datatype/m-p/12786#M7548</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I am having a delta table and table contains data and I need to alter the datatype for a particular column.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example :&lt;/P&gt;&lt;P&gt;Consider the table name is A and column name is Amount with datatype Decimal(9,4).&lt;/P&gt;&lt;P&gt;I need alter the Amount column datatype from Decimal(9,4) to Decimal(18,4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any ALTER command similar to what we have in SQL server to alter the column datatype.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone suggest any ideas on this.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2022 06:51:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/alter-delta-table-column-datatype/m-p/12786#M7548</guid>
      <dc:creator>HariharaSam</dc:creator>
      <dc:date>2022-07-22T06:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Alter Delta table column datatype</title>
      <link>https://community.databricks.com/t5/data-engineering/alter-delta-table-column-datatype/m-p/12787#M7549</link>
      <description>&lt;P&gt;At the moment you will have to rewrite the data as you cannot change the type of a column.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.delta.io/latest/delta-batch.html#change-column-type-or-name" alt="https://docs.delta.io/latest/delta-batch.html#change-column-type-or-name" target="_blank"&gt;https://docs.delta.io/latest/delta-batch.html#change-column-type-or-name&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But (others may correct me if I'm wrong here) I think type change is in the dev backlog.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 07:45:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/alter-delta-table-column-datatype/m-p/12787#M7549</guid>
      <dc:creator>-werners-</dc:creator>
      <dc:date>2022-07-25T07:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Alter Delta table column datatype</title>
      <link>https://community.databricks.com/t5/data-engineering/alter-delta-table-column-datatype/m-p/12788#M7550</link>
      <description>&lt;P&gt;Hi @Hariharan Sambath​&amp;nbsp;Please check following document: &lt;A href="https://docs.databricks.com/spark/2.x/spark-sql/language-manual/alter-table-or-view.html#change-columns" target="test_blank"&gt;https://docs.databricks.com/spark/2.x/spark-sql/language-manual/alter-table-or-view.html#change-columns&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 21:02:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/alter-delta-table-column-datatype/m-p/12788#M7550</guid>
      <dc:creator>Noopur_Nigam</dc:creator>
      <dc:date>2022-08-30T21:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: Alter Delta table column datatype</title>
      <link>https://community.databricks.com/t5/data-engineering/alter-delta-table-column-datatype/m-p/12789#M7551</link>
      <description>&lt;P&gt;from pyspark.sql.functions import *&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;spark.read.table("schema.table") \&lt;/P&gt;&lt;P&gt;          .withColumn("namecolumn",col("namecolumn").cast("string")) \&lt;/P&gt;&lt;P&gt;          .write.format("delta").mode("overwrite").option("overwriteSchema",true).saveAsTable("schema.table")&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 16:13:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/alter-delta-table-column-datatype/m-p/12789#M7551</guid>
      <dc:creator>183530</dc:creator>
      <dc:date>2023-04-12T16:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Alter Delta table column datatype</title>
      <link>https://community.databricks.com/t5/data-engineering/alter-delta-table-column-datatype/m-p/37801#M26461</link>
      <description>&lt;P&gt;&lt;SPAN&gt;.write.format("delta").mode("overwrite").option("overwriteSchema",true).saveAsTable("schema.table")&lt;BR /&gt;&lt;/SPAN&gt;Need to add double quotes around true..&lt;BR /&gt;&lt;SPAN&gt;.option("overwriteSchema","true")&lt;BR /&gt;Key-value should be string, not Boolean&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 17:36:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/alter-delta-table-column-datatype/m-p/37801#M26461</guid>
      <dc:creator>virajrathod</dc:creator>
      <dc:date>2023-07-17T17:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Alter Delta table column datatype</title>
      <link>https://community.databricks.com/t5/data-engineering/alter-delta-table-column-datatype/m-p/37981#M26530</link>
      <description>&lt;P&gt;You will need to write the data to a new table. Read the data in spark and cast the data and write it to a new table.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 19:11:23 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/alter-delta-table-column-datatype/m-p/37981#M26530</guid>
      <dc:creator>Lakshay</dc:creator>
      <dc:date>2023-07-19T19:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Alter Delta table column datatype</title>
      <link>https://community.databricks.com/t5/data-engineering/alter-delta-table-column-datatype/m-p/37984#M26532</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/4824"&gt;@HariharaSam&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following documents the info about how to alter a Delta table schema.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/delta/update-schema.html" target="_blank"&gt;https://docs.databricks.com/delta/update-schema.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 19:20:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/alter-delta-table-column-datatype/m-p/37984#M26532</guid>
      <dc:creator>saipujari_spark</dc:creator>
      <dc:date>2023-07-19T19:20:26Z</dc:date>
    </item>
  </channel>
</rss>

