<?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: Read Database tables and convert into CSV format in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Read-Database-tables-and-convert-into-CSV-format/m-p/176493#M75539</link>
    <description>&lt;A rel="user" href="https://community.cloudera.com/users/70238/rameshgangineni1991.html" nodeid="70238"&gt;@User 805&lt;/A&gt;&lt;P&gt;As you are using NiFi 1.5 you can use &lt;STRONG&gt;Avroreader as RecordReader&lt;/STRONG&gt; and &lt;STRONG&gt;CsvRecordSetWriter as Record Writer&lt;/STRONG&gt; in ConvertRecord processor.&lt;/P&gt;&lt;PRE&gt;ConvertRecord processor &lt;BR /&gt;RecordReader--&amp;gt;AvroReader//reads the incoming avro format flowfile contents
RecordWriter--&amp;gt;CsvRecordSetWriter//write the output results in csv format&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt; Flow:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;ListDatabaseTables&lt;/LI&gt;&lt;LI&gt;GenerateTableFetch&lt;/LI&gt;&lt;LI&gt;UpdateAttribute(are you changing the filename to UUID?)&lt;/LI&gt;&lt;LI&gt;ConvertRecord&lt;/LI&gt;&lt;LI&gt;PutS3Object&lt;BR /&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Please refer to below link to configure AvroReader &lt;BR /&gt;&lt;A href="https://community.hortonworks.com/questions/175208/how-to-store-the-output-of-a-query-to-one-text-fil.html?childToView=174434#comment-174434" target="_blank"&gt;https://community.hortonworks.com/questions/175208/how-to-store-the-output-of-a-query-to-one-text-fil.html?childToView=174434#comment-174434&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If you are still facing issues then share us sample of 10 records in csv (or) json format to recreate your scenario on our side.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Mar 2018 20:05:07 GMT</pubDate>
    <dc:creator>Shu_ashu</dc:creator>
    <dc:date>2018-03-08T20:05:07Z</dc:date>
    <item>
      <title>Read Database tables and convert into CSV format</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Read-Database-tables-and-convert-into-CSV-format/m-p/176492#M75538</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;I'm trying to read the data from MySQL database and trying to place the data in S3. I was able to read the data from MySQL and able to place the data in S3 bucket as well. However whatever the data I'm placing in S3 bucket is not a CSV data. It's JSON data. Below is the flow I have right now. I have total 6 tables that I need to read from database and each table have different schema.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="64537-mainflow.png" style="width: 979px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/19678i29447FFB33714252/image-size/medium?v=v2&amp;amp;px=400" role="button" title="64537-mainflow.png" alt="64537-mainflow.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to place the CSV data in S3 bucket. For that I got suggestions from experts and I was bit puzzled whatever I'm doing is correct or not. Any other possible solutions/suggestions to place the CSV data in S3 bucket will be helpful for me.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Suggestions I got:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/49145832/convert-json-to-csv-in-nifi" target="_blank" rel="nofollow noopener noreferrer"&gt;https://stackoverflow.com/questions/49145832/convert-json-to-csv-in-nifi&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hortonworks.com/questions/176254/convert-json-to-csv-in-nifi.html?childToView=177079#answer-177079" target="_blank" rel="nofollow noopener noreferrer"&gt;https://community.hortonworks.com/questions/176254/convert-json-to-csv-in-nifi.html?childToView=177079#answer-177079&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="64541-inferavroschema.png" style="width: 782px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/19679iA1BD21F1E8F75BB4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="64541-inferavroschema.png" alt="64541-inferavroschema.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="64540-evaluate.png" style="width: 778px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/19680iF798568405FF6778/image-size/medium?v=v2&amp;amp;px=400" role="button" title="64540-evaluate.png" alt="64540-evaluate.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="64539-convertrecord.png" style="width: 786px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/19681i1421E3357B8E3813/image-size/medium?v=v2&amp;amp;px=400" role="button" title="64539-convertrecord.png" alt="64539-convertrecord.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="64538-plan.png" style="width: 992px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/19682i17B43B8FFFDEB5F4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="64538-plan.png" alt="64538-plan.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 09:56:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Read-Database-tables-and-convert-into-CSV-format/m-p/176492#M75538</guid>
      <dc:creator>ramesh_ganginen</dc:creator>
      <dc:date>2019-08-18T09:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Read Database tables and convert into CSV format</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Read-Database-tables-and-convert-into-CSV-format/m-p/176493#M75539</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/70238/rameshgangineni1991.html" nodeid="70238"&gt;@User 805&lt;/A&gt;&lt;P&gt;As you are using NiFi 1.5 you can use &lt;STRONG&gt;Avroreader as RecordReader&lt;/STRONG&gt; and &lt;STRONG&gt;CsvRecordSetWriter as Record Writer&lt;/STRONG&gt; in ConvertRecord processor.&lt;/P&gt;&lt;PRE&gt;ConvertRecord processor &lt;BR /&gt;RecordReader--&amp;gt;AvroReader//reads the incoming avro format flowfile contents
RecordWriter--&amp;gt;CsvRecordSetWriter//write the output results in csv format&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt; Flow:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;ListDatabaseTables&lt;/LI&gt;&lt;LI&gt;GenerateTableFetch&lt;/LI&gt;&lt;LI&gt;UpdateAttribute(are you changing the filename to UUID?)&lt;/LI&gt;&lt;LI&gt;ConvertRecord&lt;/LI&gt;&lt;LI&gt;PutS3Object&lt;BR /&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Please refer to below link to configure AvroReader &lt;BR /&gt;&lt;A href="https://community.hortonworks.com/questions/175208/how-to-store-the-output-of-a-query-to-one-text-fil.html?childToView=174434#comment-174434" target="_blank"&gt;https://community.hortonworks.com/questions/175208/how-to-store-the-output-of-a-query-to-one-text-fil.html?childToView=174434#comment-174434&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If you are still facing issues then share us sample of 10 records in csv (or) json format to recreate your scenario on our side.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 20:05:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Read-Database-tables-and-convert-into-CSV-format/m-p/176493#M75539</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2018-03-08T20:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: Read Database tables and convert into CSV format</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Read-Database-tables-and-convert-into-CSV-format/m-p/176494#M75540</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929" target="_blank"&gt;@Shu&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;I made the changes as you suggested and it worked. I added one extra processor(Execute SQL). I'm posting the flow here so that it might help someone like me in future who are having same requirement. Really appreciate your help. Thanks a lot.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="64544-screen-shot-2018-03-08-at-101317-pm.png" style="width: 985px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/19677iC42F7CC88C746FDD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="64544-screen-shot-2018-03-08-at-101317-pm.png" alt="64544-screen-shot-2018-03-08-at-101317-pm.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 09:55:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Read-Database-tables-and-convert-into-CSV-format/m-p/176494#M75540</guid>
      <dc:creator>ramesh_ganginen</dc:creator>
      <dc:date>2019-08-18T09:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: Read Database tables and convert into CSV format</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Read-Database-tables-and-convert-into-CSV-format/m-p/176495#M75541</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/70238/rameshgangineni1991.html" nodeid="70238"&gt;@User 805&lt;/A&gt;&lt;P&gt;Awesome,thankyou very much for sharing the flow with us &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 05:28:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Read-Database-tables-and-convert-into-CSV-format/m-p/176495#M75541</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2018-03-09T05:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Read Database tables and convert into CSV format</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Read-Database-tables-and-convert-into-CSV-format/m-p/385471#M75542</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi @Shu_ashu,&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/46692"&gt;@ramesh_ganginen&lt;/a&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (27).png" style="width: 680px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/40128i4578AEF13CF8087E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot (27).png" alt="Screenshot (27).png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (28).png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/40127i0124FA772495341F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot (28).png" alt="Screenshot (28).png" /&gt;&lt;/span&gt; I am encountering the same issue. I attempted the method you suggested, but it didn't work. I'm trying to copy a table from my MySQL database to my local machine using Apache NiFi. I've configured the 'ConvertRecord' processor and added the 'CSVRecordSetWriter', but I'm still receiving files in JSON format. Can you please guide me if I'm making any mistakes?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Mar 2024 20:31:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Read-Database-tables-and-convert-into-CSV-format/m-p/385471#M75542</guid>
      <dc:creator>sajidkhan</dc:creator>
      <dc:date>2024-03-24T20:31:50Z</dc:date>
    </item>
  </channel>
</rss>

