<?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>question Re: insert in one table get the ID and then include that id in next insert in Apache Nifi in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/insert-in-one-table-get-the-ID-and-then-include-that-id-in/m-p/391713#M247736</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/113398"&gt;@Adyant001&lt;/a&gt;&amp;nbsp; &amp;nbsp; Can you share sample json structure ?&lt;/P&gt;&lt;P&gt;If source json contains both parent and child information, you can have two PutDatabaseRecord processors connected in series with right "&lt;SPAN&gt;Data Record Path" mentioned.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If child record needs information from parent level, JoltTransformJson processor can be used to create transformed json before passing to PutDatabaseRecord.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Aug 2024 19:17:43 GMT</pubDate>
    <dc:creator>shiva239</dc:creator>
    <dc:date>2024-08-13T19:17:43Z</dc:date>
    <item>
      <title>insert in one table get the ID and then include that id in next insert in Apache Nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/insert-in-one-table-get-the-ID-and-then-include-that-id-in/m-p/391676#M247724</link>
      <description>&lt;P&gt;I need to inject data read from elastic in Json format to two different tables having parent child relationship.&lt;/P&gt;&lt;P&gt;i.e&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;User table&lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;Name, Age, Role&lt;BR /&gt;David,35,1

Tay,23,2

John,27,2&lt;/PRE&gt;&lt;UL&gt;&lt;LI&gt;Role table:&lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;1,admin

2,user&lt;/PRE&gt;&lt;P&gt;My requirement is to &lt;SPAN&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;insert in user table first get the Role ID and then include that id in next insert to dump data in Role table&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;How can i achieve this thing Apache Nifi?@mburgess&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 12:55:20 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/insert-in-one-table-get-the-ID-and-then-include-that-id-in/m-p/391676#M247724</guid>
      <dc:creator>Adyant001</dc:creator>
      <dc:date>2024-08-13T12:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: insert in one table get the ID and then include that id in next insert in Apache Nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/insert-in-one-table-get-the-ID-and-then-include-that-id-in/m-p/391713#M247736</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/113398"&gt;@Adyant001&lt;/a&gt;&amp;nbsp; &amp;nbsp; Can you share sample json structure ?&lt;/P&gt;&lt;P&gt;If source json contains both parent and child information, you can have two PutDatabaseRecord processors connected in series with right "&lt;SPAN&gt;Data Record Path" mentioned.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If child record needs information from parent level, JoltTransformJson processor can be used to create transformed json before passing to PutDatabaseRecord.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 19:17:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/insert-in-one-table-get-the-ID-and-then-include-that-id-in/m-p/391713#M247736</guid>
      <dc:creator>shiva239</dc:creator>
      <dc:date>2024-08-13T19:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: insert in one table get the ID and then include that id in next insert in Apache Nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/insert-in-one-table-get-the-ID-and-then-include-that-id-in/m-p/391725#M247744</link>
      <description>&lt;DIV&gt;[&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"name": "sugam",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"age": 30,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"id": 1,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"role": {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"role": "Admin"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;]&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I wanted to put &lt;STRONG&gt;name ,age, and id&lt;/STRONG&gt; to user table then get the id from user table and put it in role table with role as admin&lt;/DIV&gt;&lt;DIV&gt;Desired out put should be as below&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;user table:&lt;/DIV&gt;&lt;DIV&gt;Name&amp;nbsp; age ID(pk)&lt;/DIV&gt;&lt;DIV&gt;sugam 30&amp;nbsp; &amp;nbsp;1&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Role Table:&lt;/DIV&gt;&lt;DIV&gt;Id(pk)&amp;nbsp; Role_id(fk) Role_name&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;admin&amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/38301"&gt;@mburgess&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Wed, 14 Aug 2024 07:46:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/insert-in-one-table-get-the-ID-and-then-include-that-id-in/m-p/391725#M247744</guid>
      <dc:creator>Adyant001</dc:creator>
      <dc:date>2024-08-14T07:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: insert in one table get the ID and then include that id in next insert in Apache Nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/insert-in-one-table-get-the-ID-and-then-include-that-id-in/m-p/391762#M247764</link>
      <description>&lt;P&gt;I would do this way.&amp;nbsp; Please see if this works for you.&lt;/P&gt;&lt;P&gt;1. Use JolttransformJSON processor to alter the input JSON&lt;/P&gt;&lt;P&gt;Spec:&lt;/P&gt;&lt;P&gt;[&lt;BR /&gt;{&lt;BR /&gt;"operation": "shift",&lt;BR /&gt;"spec": {&lt;BR /&gt;"id": ["role.role_id", "user.id"],&lt;BR /&gt;"name": "user.name",&lt;BR /&gt;"age": "user.age",&lt;BR /&gt;"role": {&lt;BR /&gt;"role": "role.role_name"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;]&lt;/P&gt;&lt;P&gt;2. Pass the transformed JSON to first PutDatabaseRecord processor to insert into user table&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Set "&lt;SPAN&gt;Data Record Path"&amp;nbsp; = user&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3.&amp;nbsp; Add another&amp;nbsp;PutDatabaseRecord processor to insert into role table&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Set "Data Record Path"&amp;nbsp; = role&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 19:52:20 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/insert-in-one-table-get-the-ID-and-then-include-that-id-in/m-p/391762#M247764</guid>
      <dc:creator>shiva239</dc:creator>
      <dc:date>2024-08-14T19:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: insert in one table get the ID and then include that id in next insert in Apache Nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/insert-in-one-table-get-the-ID-and-then-include-that-id-in/m-p/391795#M247776</link>
      <description>&lt;P&gt;HI Shiva239.&lt;/P&gt;&lt;P&gt;The solution seems working for me but the child table(role) has an autoincrement PK column.&lt;/P&gt;&lt;P&gt;SO how to insert value in autoincrement column&lt;/P&gt;&lt;DIV&gt;Role Table:&lt;/DIV&gt;&lt;DIV&gt;Id(&lt;STRONG&gt;pk auto increamne)&lt;/STRONG&gt;&amp;nbsp; Role_id(&lt;STRONG&gt;fk&lt;/STRONG&gt;) Role_name&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;admin&amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 16 Aug 2024 10:30:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/insert-in-one-table-get-the-ID-and-then-include-that-id-in/m-p/391795#M247776</guid>
      <dc:creator>Adyant001</dc:creator>
      <dc:date>2024-08-16T10:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: insert in one table get the ID and then include that id in next insert in Apache Nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/insert-in-one-table-get-the-ID-and-then-include-that-id-in/m-p/391802#M247779</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/113398"&gt;@Adyant001&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oracle has auto increment IDENTITY feature as below.&lt;/P&gt;&lt;P&gt;Table definition takes care of setting primary key incremental value. No need to send this value in json payload&lt;/P&gt;&lt;P&gt;I think all other major RDBMS have similar feature to assign auto increment value.&lt;/P&gt;&lt;P&gt;CREATE TABLE roletab&lt;BR /&gt;(id NUMBER &lt;STRONG&gt;GENERATED BY DEFAULT ON NULL AS IDENTITY &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;(START WITH 1 INCREMENT BY 1 NOCYCLE)&lt;/STRONG&gt;,&lt;BR /&gt;role_id NUMBER,&lt;BR /&gt;role_name VARCHAR(100),&lt;BR /&gt;PRIMARY KEY (id)&lt;BR /&gt;);&lt;BR /&gt;&lt;BR /&gt;INSERT INTO roletab (role_id, role_name) VALUES (10, 'Admin');&lt;BR /&gt;INSERT INTO roletab (role_id, role_name) VALUES (20, 'Developer');&lt;BR /&gt;commit;&lt;/P&gt;&lt;P&gt;SELECT * FROM roletab;&lt;/P&gt;&lt;P&gt;ID |ROLE_ID|ROLE_NAME|&lt;BR /&gt;--+-------+---------+&lt;BR /&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&amp;nbsp; &amp;nbsp; | 10&amp;nbsp; &amp;nbsp; &amp;nbsp;| Admin |&lt;BR /&gt;&lt;STRONG&gt;2&amp;nbsp;&lt;/STRONG&gt; &amp;nbsp;| 20&amp;nbsp; &amp;nbsp; |Developer|&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 15:43:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/insert-in-one-table-get-the-ID-and-then-include-that-id-in/m-p/391802#M247779</guid>
      <dc:creator>shiva239</dc:creator>
      <dc:date>2024-08-16T15:43:00Z</dc:date>
    </item>
  </channel>
</rss>

