<?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 Spliting CSV files into 2 and saving them on Postgresql. in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Spliting-CSV-files-into-2-and-saving-them-on-Postgresql/m-p/347366#M235139</link>
    <description>&lt;P&gt;Hello. I am currently using Nifi and Postgres via docker compose and is currently working on a sample project to get used to the tools.&lt;/P&gt;&lt;P&gt;I am given a sample CSV file with 4 columns (grade, breed, gender, price)&lt;/P&gt;&lt;P&gt;my scenario is as follows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Split the sample CSV file into 2. (rows that have null value and rows that dont. So in the case below, row 1, 4 will be in the same table, and 2, 3 in the same table)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Grade   ,BreedNm       ,Gender      ,Price
C++     ,beef_cattle   ,Female      ,10094
C++     ,milk_cow      ,Female      ,null
null    ,beef_cattle   ,Male        ,12704
B++     ,milk_cow      ,Female      ,16942&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;2. Save each of them into Postgresql tables&lt;/P&gt;&lt;P&gt;3. Also save the logs into a table, using ID and the sequence of the log table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is what I tried&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="화면 캡처 2022-07-12 131739.png" style="width: 637px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34844i89A3FFDCE227A645/image-size/large?v=v2&amp;amp;px=999" role="button" title="화면 캡처 2022-07-12 131739.png" alt="화면 캡처 2022-07-12 131739.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;1. Split flowfile in two.&lt;/P&gt;&lt;P&gt;2. On one side, only save rows without null values and save them into a table&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. On the other side, save rows with null values and also save them into a table&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I achieve the desired outcome?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am mainly having struggle with&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Only saving rows with null value&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Saving them into postgresql table&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help in advance!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Jul 2022 04:23:55 GMT</pubDate>
    <dc:creator>Lewis_King</dc:creator>
    <dc:date>2022-07-12T04:23:55Z</dc:date>
    <item>
      <title>Spliting CSV files into 2 and saving them on Postgresql.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Spliting-CSV-files-into-2-and-saving-them-on-Postgresql/m-p/347366#M235139</link>
      <description>&lt;P&gt;Hello. I am currently using Nifi and Postgres via docker compose and is currently working on a sample project to get used to the tools.&lt;/P&gt;&lt;P&gt;I am given a sample CSV file with 4 columns (grade, breed, gender, price)&lt;/P&gt;&lt;P&gt;my scenario is as follows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Split the sample CSV file into 2. (rows that have null value and rows that dont. So in the case below, row 1, 4 will be in the same table, and 2, 3 in the same table)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Grade   ,BreedNm       ,Gender      ,Price
C++     ,beef_cattle   ,Female      ,10094
C++     ,milk_cow      ,Female      ,null
null    ,beef_cattle   ,Male        ,12704
B++     ,milk_cow      ,Female      ,16942&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;2. Save each of them into Postgresql tables&lt;/P&gt;&lt;P&gt;3. Also save the logs into a table, using ID and the sequence of the log table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is what I tried&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="화면 캡처 2022-07-12 131739.png" style="width: 637px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34844i89A3FFDCE227A645/image-size/large?v=v2&amp;amp;px=999" role="button" title="화면 캡처 2022-07-12 131739.png" alt="화면 캡처 2022-07-12 131739.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;1. Split flowfile in two.&lt;/P&gt;&lt;P&gt;2. On one side, only save rows without null values and save them into a table&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. On the other side, save rows with null values and also save them into a table&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I achieve the desired outcome?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am mainly having struggle with&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Only saving rows with null value&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Saving them into postgresql table&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 04:23:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Spliting-CSV-files-into-2-and-saving-them-on-Postgresql/m-p/347366#M235139</guid>
      <dc:creator>Lewis_King</dc:creator>
      <dc:date>2022-07-12T04:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Spliting CSV files into 2 and saving them on Postgresql.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Spliting-CSV-files-into-2-and-saving-them-on-Postgresql/m-p/347413#M235156</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm not sure how are you splitting the CSV using UpdateAttribute. You probably need to use something like QueryRecord processor where you can query the records in SQL like language, there you create two routing properties: one for&amp;nbsp; ValuesWithNull and another for ValuesWithoutNull, then you redirect each to Save to the DB. Also why are you using the ConvertRecord Processor ? Are you converting the csv to another format like Json?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 13:30:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Spliting-CSV-files-into-2-and-saving-them-on-Postgresql/m-p/347413#M235156</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2022-07-12T13:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Spliting CSV files into 2 and saving them on Postgresql.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Spliting-CSV-files-into-2-and-saving-them-on-Postgresql/m-p/347430#M235163</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;pointed out kindly checked the attached xml:&lt;/P&gt;&lt;P&gt;1) Get the csv file&lt;/P&gt;&lt;P&gt;2) query the csv file for null &amp;amp; not null using query record. The queries are represented by variables.&lt;/P&gt;&lt;P&gt;3) the null &amp;amp; not null variables are used for routing.&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;&lt;P&gt;get xml from here:&amp;nbsp;&lt;A href="https://drive.google.com/file/d/1DjrW46GCRlVUTVGRP1HXRVKOREWCKUWe/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/1DjrW46GCRlVUTVGRP1HXRVKOREWCKUWe/view?usp=sharing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 20:01:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Spliting-CSV-files-into-2-and-saving-them-on-Postgresql/m-p/347430#M235163</guid>
      <dc:creator>rafy</dc:creator>
      <dc:date>2022-07-12T20:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: Spliting CSV files into 2 and saving them on Postgresql.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Spliting-CSV-files-into-2-and-saving-them-on-Postgresql/m-p/347434#M235166</link>
      <description>&lt;P&gt;I am an absolute newbie and was following other tutorials.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_tears_of_joy:"&gt;😂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I thought it was necessary to convert it to JSON to store the data into Postgresql.&lt;/P&gt;&lt;P&gt;Thanks a lot for the help !&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 00:41:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Spliting-CSV-files-into-2-and-saving-them-on-Postgresql/m-p/347434#M235166</guid>
      <dc:creator>Lewis_King</dc:creator>
      <dc:date>2022-07-13T00:41:56Z</dc:date>
    </item>
  </channel>
</rss>

