<?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: [Nifi] Converting a delimited FlowFile's content to attributes in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211919#M74385</link>
    <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt; How about if just wanna keep the content as Attribute? Like my scenario is that I want a user to give parameters through a csv which I can parse and use them attribute , for example like User wants to import a tbale , he will write table in csv and that I'll use as an attribite in flowfile.&lt;/P&gt;&lt;P&gt;My present approach is :&lt;/P&gt;&lt;P&gt;ListFile-&amp;gt;FetchFile-&amp;gt;SplitFile-&amp;gt;extractText-&amp;gt;updateAttribute. But doesn't seems to be wroking out. Any suggestions?&lt;/P&gt;</description>
    <pubDate>Fri, 27 Jul 2018 23:41:18 GMT</pubDate>
    <dc:creator>ash_darkstar99</dc:creator>
    <dc:date>2018-07-27T23:41:18Z</dc:date>
    <item>
      <title>[Nifi] Converting a delimited FlowFile's content to attributes</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211912#M74378</link>
      <description>&lt;P&gt;Hi, guys,&lt;/P&gt;&lt;P&gt;So I have an incoming FlowFile with content text delimited by pipes ('|'), and I want to send this information to several destinations. To convert it to JSON, for example, I know I can use the AttributesToJSON processor, but how exactly can I access the FlowFile content and convert them to attributes?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;e.g.&lt;/P&gt;&lt;P&gt;original FlowFile content:&lt;/P&gt;&lt;P&gt;1234567891285|37797|1| the brown fox&lt;BR /&gt;FlowFile attributes (after converting):&lt;/P&gt;&lt;P&gt;id = 1234567891285&lt;BR /&gt;sequence = 37797&lt;BR /&gt;category = 1&lt;BR /&gt;text = the brown fox&lt;BR /&gt;... and after that I could use AttributesToJSON to generate my JSON file.&lt;/P&gt;&lt;P&gt;Any ideas on how to achieve this?&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 01:45:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211912#M74378</guid>
      <dc:creator>crodriguesfilho</dc:creator>
      <dc:date>2018-02-08T01:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: [Nifi] Converting a delimited FlowFile's content to attributes</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211913#M74379</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/62294/crodriguesfilho.html" nodeid="62294"&gt;@Cesar Rodrigues&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The cleaniest way should be to use &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.5.0/org.apache.nifi.processors.standard.ConvertRecord/index.html" target="_blank"&gt;ConvertRecord&lt;/A&gt; processor with a &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-record-serialization-services-nar/1.5.0/org.apache.nifi.csv.CSVReader/index.html" target="_blank"&gt;CSVReader&lt;/A&gt; (using Delimiter as pipe) and &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-record-serialization-services-nar/1.5.0/org.apache.nifi.json.JsonRecordSetWriter/index.html" target="_blank"&gt;JSonSetRecordWriter&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;This directly convert your CSV into JSON without passing by attributes. Using Record processors also gives you better performance.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 01:50:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211913#M74379</guid>
      <dc:creator>ahadjidj</dc:creator>
      <dc:date>2018-02-08T01:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: [Nifi] Converting a delimited FlowFile's content to attributes</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211914#M74380</link>
      <description>&lt;P&gt;You don't have to extract the fields to attributes if you are converting the contents to a different format, instead you can use &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.5.0/org.apache.nifi.processors.standard.ConvertRecord/index.html" target="_blank"&gt;ConvertRecord&lt;/A&gt; with a &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-record-serialization-services-nar/1.5.0/org.apache.nifi.csv.CSVReader/index.html" target="_blank"&gt;CSVReader&lt;/A&gt; with custom format (a pipe delimiter for instance) and name your fields in the Avro schema. Then in ConvertRecord you can set a &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-record-serialization-services-nar/1.5.0/org.apache.nifi.json.JsonRecordSetWriter/index.html" target="_blank"&gt;JsonRecordSetWriter&lt;/A&gt; to convert to JSON. This same approach will work for any supported output format, or you can even write your own &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-scripting-nar/1.5.0/org.apache.nifi.record.script.ScriptedRecordSetWriter/index.html" target="_blank"&gt;ScriptedRecordSetWriter&lt;/A&gt; if you need a custom format.&lt;/P&gt;&lt;P&gt;If you do need to extract to attributes, you can use &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.5.0/org.apache.nifi.processors.standard.ExtractText/index.html" target="_blank"&gt;ExtractText&lt;/A&gt; with a regular expression that matches each field, and you can add user-defined properties to extract the group(s) into their associated attributes (the property name is the field name such as "id" or "sequence", and the value is the grouping expression, perhaps $2, $3, etc.)&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 01:59:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211914#M74380</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2018-02-08T01:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: [Nifi] Converting a delimited FlowFile's content to attributes</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211915#M74381</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt;&lt;P&gt;I've never used the Avro Schema before. Could you please explain how to name the fields in it? I checked the documentation, but it's a little bit confusing.&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 04:06:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211915#M74381</guid>
      <dc:creator>crodriguesfilho</dc:creator>
      <dc:date>2018-02-08T04:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: [Nifi] Converting a delimited FlowFile's content to attributes</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211916#M74382</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/2056/ahadjidj.html" nodeid="2056"&gt;@Abdelkrim Hadjidj&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thank you! Could you please provide more details on how to use the schema registry? I'm having some trouble with that.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 04:08:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211916#M74382</guid>
      <dc:creator>crodriguesfilho</dc:creator>
      <dc:date>2018-02-08T04:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: [Nifi] Converting a delimited FlowFile's content to attributes</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211917#M74383</link>
      <description>&lt;P&gt;Avro Schemas can be confusing the first couple of times you create them &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; In your case you could use the following:&lt;/P&gt;&lt;PRE&gt;{
 "namespace": "nifi",
 "name": "cesarPipeDelimitedRecord",
 "type": "record",
 "fields": [
  {"name": "id","type": "string"},
  {"name": "sequence","type": "int"},
  {"name": "category","type": "int"},
  {"name": "text","type": "string"}
]
}&lt;/PRE&gt;&lt;P&gt;If you can have missing values, then you can replace the type with a union, for example if "category" can be missing, then its field entry can be&lt;/P&gt;&lt;PRE&gt;{"name": "category","type": ["null","int"]},&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Feb 2018 04:19:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211917#M74383</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2018-02-08T04:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: [Nifi] Converting a delimited FlowFile's content to attributes</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211918#M74384</link>
      <description>&lt;P&gt;Thanks, &lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt;! This helped a lot &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 02:17:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211918#M74384</guid>
      <dc:creator>crodriguesfilho</dc:creator>
      <dc:date>2018-02-15T02:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: [Nifi] Converting a delimited FlowFile's content to attributes</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211919#M74385</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt; How about if just wanna keep the content as Attribute? Like my scenario is that I want a user to give parameters through a csv which I can parse and use them attribute , for example like User wants to import a tbale , he will write table in csv and that I'll use as an attribite in flowfile.&lt;/P&gt;&lt;P&gt;My present approach is :&lt;/P&gt;&lt;P&gt;ListFile-&amp;gt;FetchFile-&amp;gt;SplitFile-&amp;gt;extractText-&amp;gt;updateAttribute. But doesn't seems to be wroking out. Any suggestions?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 23:41:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211919#M74385</guid>
      <dc:creator>ash_darkstar99</dc:creator>
      <dc:date>2018-07-27T23:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: [Nifi] Converting a delimited FlowFile's content to attributes</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211920#M74386</link>
      <description>&lt;P&gt;What issues are you having? That flow description seems like it should work. Perhaps your regular expression or other config of ExtractText needs tweaking?&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jul 2018 00:53:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Converting-a-delimited-FlowFile-s-content-to-attributes/m-p/211920#M74386</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2018-07-28T00:53:53Z</dc:date>
    </item>
  </channel>
</rss>

