<?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: Update data type of a column within a table that has a GENERATED ALWAYS AS IDENTITY-column in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/update-data-type-of-a-column-within-a-table-that-has-a-generated/m-p/15720#M10013</link>
    <description>&lt;P&gt;Looks like it works when using GENERATED BY DEFAULT AS IDENTITY instead. There's no way of updating the schema from GENERATED ALWAYS AS IDENTITY to GENERATED BY DEFAULT AS IDENTITY, right? I have to create a new table (and then insert it with data from old table)?&lt;/P&gt;</description>
    <pubDate>Tue, 20 Dec 2022 15:25:37 GMT</pubDate>
    <dc:creator>Abbe</dc:creator>
    <dc:date>2022-12-20T15:25:37Z</dc:date>
    <item>
      <title>Update data type of a column within a table that has a GENERATED ALWAYS AS IDENTITY-column</title>
      <link>https://community.databricks.com/t5/data-engineering/update-data-type-of-a-column-within-a-table-that-has-a-generated/m-p/15719#M10012</link>
      <description>&lt;P&gt;I want to cast the data type of a column "X" in a table "A" where column "ID" is defined as &lt;I&gt;GENERATED ALWAYS AS IDENTITY. &lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Databricks refer to overwrite to achieve this: &lt;A href="https://docs.databricks.com/delta/update-schema.html" target="test_blank"&gt;https://docs.databricks.com/delta/update-schema.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following operation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;(spark.read.table('A')&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&amp;nbsp;.withColumn("X", col("X").cast("string"))&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&amp;nbsp;.write&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&amp;nbsp;.mode("overwrite")&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&amp;nbsp;.option("overwriteSchema", "true")&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&amp;nbsp;.saveAsTable('A')&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;)&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Returns this error message:&lt;/P&gt;&lt;P&gt;&lt;I&gt;AnalysisException: Providing values for GENERATED ALWAYS AS IDENTITY column ID is not supported.&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I cast columns for tables with &lt;I&gt;GENERATED ALWAYS AS IDENTITY-columns?&lt;/I&gt; The same applies to renaming columns.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 15:04:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/update-data-type-of-a-column-within-a-table-that-has-a-generated/m-p/15719#M10012</guid>
      <dc:creator>Abbe</dc:creator>
      <dc:date>2022-12-20T15:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Update data type of a column within a table that has a GENERATED ALWAYS AS IDENTITY-column</title>
      <link>https://community.databricks.com/t5/data-engineering/update-data-type-of-a-column-within-a-table-that-has-a-generated/m-p/15720#M10013</link>
      <description>&lt;P&gt;Looks like it works when using GENERATED BY DEFAULT AS IDENTITY instead. There's no way of updating the schema from GENERATED ALWAYS AS IDENTITY to GENERATED BY DEFAULT AS IDENTITY, right? I have to create a new table (and then insert it with data from old table)?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 15:25:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/update-data-type-of-a-column-within-a-table-that-has-a-generated/m-p/15720#M10013</guid>
      <dc:creator>Abbe</dc:creator>
      <dc:date>2022-12-20T15:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Update data type of a column within a table that has a GENERATED ALWAYS AS IDENTITY-column</title>
      <link>https://community.databricks.com/t5/data-engineering/update-data-type-of-a-column-within-a-table-that-has-a-generated/m-p/67950#M33486</link>
      <description>&lt;P&gt;Update is not working but delete is when i changed to DEFAULT property&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;AnalysisException&lt;/SPAN&gt;&lt;SPAN&gt;: UPDATE on IDENTITY column "XXXX_ID" is not supported.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2024 13:32:16 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/update-data-type-of-a-column-within-a-table-that-has-a-generated/m-p/67950#M33486</guid>
      <dc:creator>RajuBolla</dc:creator>
      <dc:date>2024-05-02T13:32:16Z</dc:date>
    </item>
  </channel>
</rss>

