<?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: Unity Catalog Primary key column taking duplicates in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/unity-catalog-primary-key-column-taking-duplicates/m-p/4420#M1149</link>
    <description>&lt;P&gt;@Debayan Mukherjee​&amp;nbsp;Im able to insert the same record where we have Primary key setup on the table.&lt;/P&gt;</description>
    <pubDate>Mon, 15 May 2023 17:03:40 GMT</pubDate>
    <dc:creator>AkasBala</dc:creator>
    <dc:date>2023-05-15T17:03:40Z</dc:date>
    <item>
      <title>Unity Catalog Primary key column taking duplicates</title>
      <link>https://community.databricks.com/t5/data-engineering/unity-catalog-primary-key-column-taking-duplicates/m-p/4418#M1147</link>
      <description>&lt;P&gt;I have Updated a Hive Meta Store from a Unity Catalog. I have setup Primary keys on the&amp;nbsp;table. When I try to insert duplicates its succeeding Inserts and seems like PK is not working. Anyone else seeing such behaviour ?&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2023 06:41:13 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unity-catalog-primary-key-column-taking-duplicates/m-p/4418#M1147</guid>
      <dc:creator>AkasBala</dc:creator>
      <dc:date>2023-05-14T06:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Unity Catalog Primary key column taking duplicates</title>
      <link>https://community.databricks.com/t5/data-engineering/unity-catalog-primary-key-column-taking-duplicates/m-p/4420#M1149</link>
      <description>&lt;P&gt;@Debayan Mukherjee​&amp;nbsp;Im able to insert the same record where we have Primary key setup on the table.&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 17:03:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unity-catalog-primary-key-column-taking-duplicates/m-p/4420#M1149</guid>
      <dc:creator>AkasBala</dc:creator>
      <dc:date>2023-05-15T17:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Unity Catalog Primary key column taking duplicates</title>
      <link>https://community.databricks.com/t5/data-engineering/unity-catalog-primary-key-column-taking-duplicates/m-p/4421#M1150</link>
      <description>&lt;P&gt;-----------------&lt;/P&gt;&lt;P&gt;ALTER TABLE ccietlfindev.finsilver.companyperiods ALTER COLUMN iCompanyId SET NOT NULL;&lt;/P&gt;&lt;P&gt;ALTER TABLE ccietlfindev.finsilver.companyperiods ALTER COLUMN iPeriodId SET NOT NULL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ALTER TABLE ccietlfindev.finsilver.companyperiods ADD CONSTRAINT companyperiods_pk PRIMARY KEY(iCompanyId,iPeriodId);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select iCompanyId,iPeriodId, count(1) from ccietlfindev.finsilver.companyperiods&lt;/P&gt;&lt;P&gt;group by iCompanyId,iPeriodId&lt;/P&gt;&lt;P&gt;having count(1) &amp;gt; 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;insert into table ccietlfindev.finsilver.companyperiods&lt;/P&gt;&lt;P&gt;values ('1','182','1996-08-31 23:59:59.998','Aug 1998','1996-08-31 00:00:00.000','C','2023-05-11 15:01:43.707')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select * from ccietlfindev.finsilver.companyperiods&lt;/P&gt;&lt;P&gt;where iCompanyId = '1' and iPeriodId='182'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete from ccietlfindev.finsilver.companyperiods&lt;/P&gt;&lt;P&gt;where &amp;nbsp;iCompanyId = '1' and iPeriodId='182' and PeriodDesc='Aug 1997'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select * from companyperiods&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the case when I run count after the second record insert, I see 2 records instead of just one and should have failed saying "you are trying to insert duplicate records where there is a primary key setup" &lt;/P&gt;&lt;P&gt;@Debayan Mukherjee​&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 17:13:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unity-catalog-primary-key-column-taking-duplicates/m-p/4421#M1150</guid>
      <dc:creator>AkasBala</dc:creator>
      <dc:date>2023-05-15T17:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Unity Catalog Primary key column taking duplicates</title>
      <link>https://community.databricks.com/t5/data-engineering/unity-catalog-primary-key-column-taking-duplicates/m-p/4422#M1151</link>
      <description>&lt;P&gt;@Debayan Mukherjee​&amp;nbsp;Any info on the above plz ??&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 13:25:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unity-catalog-primary-key-column-taking-duplicates/m-p/4422#M1151</guid>
      <dc:creator>AkasBala</dc:creator>
      <dc:date>2023-05-17T13:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Unity Catalog Primary key column taking duplicates</title>
      <link>https://community.databricks.com/t5/data-engineering/unity-catalog-primary-key-column-taking-duplicates/m-p/4419#M1148</link>
      <description>&lt;P&gt;Hi, When you say PK is not working, is there any error surfaced? &lt;/P&gt;&lt;P&gt;Please tag&amp;nbsp;&lt;A href="https://community.databricks.com/s/profile/0053f000000WWwvAAG" alt="https://community.databricks.com/s/profile/0053f000000WWwvAAG" target="_blank"&gt;@Debayan&lt;/A&gt;​&amp;nbsp;with your next comment so that I will get notified. Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 16:38:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unity-catalog-primary-key-column-taking-duplicates/m-p/4419#M1148</guid>
      <dc:creator>Debayan</dc:creator>
      <dc:date>2023-05-15T16:38:42Z</dc:date>
    </item>
  </channel>
</rss>

