Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to pass flow files to the Execute Python script and use attributes & nifi variables to store that file?

Highlighted

How to pass flow files to the Execute Python script and use attributes & nifi variables to store that file?

New Contributor

Hi all,

I am a rookie at both NiFi and Python and I need your help to pass the Flow File attribute value to the script. The script is converting a nested json into csv. When I run the script locally it works.


import pandas as pd

import json

from pandas.io.json import json_normalize


src_json = "C:/Users/name/Documents/Filename.json"

tgt_csv = "C:/Users/name/Documents/Filename.csv"


jfile = open(src_json)

jdata = json.load(jfile)


How can I pass the FlowFile name to src_json and tgt_csv?


Thanks,

Rosa





1 REPLY 1

Re: How to pass flow files to the Execute Python script and use attributes & nifi variables to store that file?

Community Manager

The above was originally posted in the Community Help track. On Sat May 11 02:55 UTC 2019, the HCC moderation staff moved it to the Data Ingestion & Streaming track. The Community Help track is appropriate for questions about using the HCC Community site itself.