<?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 Identity column has null values in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/identity-column-has-null-values/m-p/75709#M7578</link>
    <description>&lt;P&gt;I created a table in databricks using a dbt model pre hook&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;CREATE TABLE &lt;/SPAN&gt;IF &lt;SPAN&gt;NOT EXISTS &lt;/SPAN&gt;accounts (&lt;BR /&gt;  account_id BIGINT GENERATED ALWAYS &lt;SPAN&gt;AS IDENTITY&lt;/SPAN&gt;,&lt;BR /&gt;  description STRING&lt;BR /&gt;  other columns&lt;BR /&gt;)&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;I use the same dbt model to merge values into this table in the post-hook&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;post_hook = [&lt;BR /&gt;&lt;SPAN&gt;"&lt;BR /&gt;&lt;/SPAN&gt;  MERGE &lt;SPAN&gt;INTO &lt;/SPAN&gt;accounts &lt;SPAN&gt;AS &lt;/SPAN&gt;target&lt;BR /&gt;  &lt;SPAN&gt;USING incremental_accounts&lt;/SPAN&gt; &lt;SPAN&gt;AS &lt;/SPAN&gt;source&lt;BR /&gt;  &lt;SPAN&gt;ON &amp;lt;join-condition&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;  &lt;SPAN&gt;WHEN &lt;/SPAN&gt;MATCHED &lt;SPAN&gt;THEN UPDATE SET&lt;BR /&gt;  target.description = source.description&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;  WHEN NOT MATCHED BY target THEN&lt;BR /&gt;  INSERT(description)&lt;BR /&gt;  VALUES (source.description)&lt;BR /&gt;&lt;/SPAN&gt;"&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;the model code itself is simple in the file incremental_accounts.sql&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;SELECT description from new_accounts&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;The table accounts was created by this model and only updated by this model by the post-hook queries.&lt;/P&gt;&lt;P&gt;The problem is that I noticed null values in account_id which should not be the case as it is auto-generated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I identified the same issue with 4 other tables which were built similarly using dbt models.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me with this issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jun 2024 14:00:52 GMT</pubDate>
    <dc:creator>rachit-prodigal</dc:creator>
    <dc:date>2024-06-25T14:00:52Z</dc:date>
    <item>
      <title>Identity column has null values</title>
      <link>https://community.databricks.com/t5/get-started-discussions/identity-column-has-null-values/m-p/75709#M7578</link>
      <description>&lt;P&gt;I created a table in databricks using a dbt model pre hook&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;CREATE TABLE &lt;/SPAN&gt;IF &lt;SPAN&gt;NOT EXISTS &lt;/SPAN&gt;accounts (&lt;BR /&gt;  account_id BIGINT GENERATED ALWAYS &lt;SPAN&gt;AS IDENTITY&lt;/SPAN&gt;,&lt;BR /&gt;  description STRING&lt;BR /&gt;  other columns&lt;BR /&gt;)&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;I use the same dbt model to merge values into this table in the post-hook&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;post_hook = [&lt;BR /&gt;&lt;SPAN&gt;"&lt;BR /&gt;&lt;/SPAN&gt;  MERGE &lt;SPAN&gt;INTO &lt;/SPAN&gt;accounts &lt;SPAN&gt;AS &lt;/SPAN&gt;target&lt;BR /&gt;  &lt;SPAN&gt;USING incremental_accounts&lt;/SPAN&gt; &lt;SPAN&gt;AS &lt;/SPAN&gt;source&lt;BR /&gt;  &lt;SPAN&gt;ON &amp;lt;join-condition&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;  &lt;SPAN&gt;WHEN &lt;/SPAN&gt;MATCHED &lt;SPAN&gt;THEN UPDATE SET&lt;BR /&gt;  target.description = source.description&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;  WHEN NOT MATCHED BY target THEN&lt;BR /&gt;  INSERT(description)&lt;BR /&gt;  VALUES (source.description)&lt;BR /&gt;&lt;/SPAN&gt;"&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;the model code itself is simple in the file incremental_accounts.sql&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;SELECT description from new_accounts&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;The table accounts was created by this model and only updated by this model by the post-hook queries.&lt;/P&gt;&lt;P&gt;The problem is that I noticed null values in account_id which should not be the case as it is auto-generated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I identified the same issue with 4 other tables which were built similarly using dbt models.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me with this issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 14:00:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/identity-column-has-null-values/m-p/75709#M7578</guid>
      <dc:creator>rachit-prodigal</dc:creator>
      <dc:date>2024-06-25T14:00:52Z</dc:date>
    </item>
  </channel>
</rss>

