<?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 Can we modify the constraint of a primary key in an existed table? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/can-we-modify-the-constraint-of-a-primary-key-in-an-existed/m-p/102457#M41123</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Hello Community,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Is it possible to modify the schema of an existing table that currently has an ID column without any constraints? I would like to update the schema to make the ID column a primary key with auto-increment starting by the maximum id already present in the existed table. Is recreating the schema the only way to achieve this?&lt;/P&gt;</description>
    <pubDate>Wed, 18 Dec 2024 09:52:29 GMT</pubDate>
    <dc:creator>jeremy98</dc:creator>
    <dc:date>2024-12-18T09:52:29Z</dc:date>
    <item>
      <title>Can we modify the constraint of a primary key in an existed table?</title>
      <link>https://community.databricks.com/t5/data-engineering/can-we-modify-the-constraint-of-a-primary-key-in-an-existed/m-p/102457#M41123</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Hello Community,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Is it possible to modify the schema of an existing table that currently has an ID column without any constraints? I would like to update the schema to make the ID column a primary key with auto-increment starting by the maximum id already present in the existed table. Is recreating the schema the only way to achieve this?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 09:52:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-we-modify-the-constraint-of-a-primary-key-in-an-existed/m-p/102457#M41123</guid>
      <dc:creator>jeremy98</dc:creator>
      <dc:date>2024-12-18T09:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Can we modify the constraint of a primary key in an existed table?</title>
      <link>https://community.databricks.com/t5/data-engineering/can-we-modify-the-constraint-of-a-primary-key-in-an-existed/m-p/102460#M41124</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/133094"&gt;@jeremy98&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on some old article it looks it cannot be done:&lt;/P&gt;&lt;P&gt;There are a few caveats you should keep in mind when adopting this new feature. Identity columns cannot be added to existing tables; the tables will need to be recreated with the new identity column added. To do this, simply create a new table DDL with the identity column, and insert the existing columns into the new table, and surrogate keys will be generated for the new table.&lt;/P&gt;&lt;P&gt;I think recreate and copy data will be the ea&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 10:27:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-we-modify-the-constraint-of-a-primary-key-in-an-existed/m-p/102460#M41124</guid>
      <dc:creator>PiotrMi</dc:creator>
      <dc:date>2024-12-18T10:27:52Z</dc:date>
    </item>
  </channel>
</rss>

