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.

NIFI -- How to import python libs for ExecuteScript

NIFI -- How to import python libs for ExecuteScript

Explorer

Hi all,

I am using Python ExecuteScript in Apache NiFi to list all Databases name in Mongo then load all tables name in Mongo, however, they dont have lib mongo. Do you know How to import python libs for ExecuteScript?

Or any suggestions to load all Databases name and tables name in Mongo in Nifi

Many thanks

4 REPLIES 4
Highlighted

Re: NIFI -- How to import python libs for ExecuteScript

Master Guru

@Thuy Le

-

Does your Python script execute fine via command line on your NiFi servers?

If so, did you consider instead just using the ExecuteStreamCommand processor to execute your script? This will behave in same way as executing yourself form command line and will not rely on NiFi built in libs.

-

The latest version of NiFi contain numerous mongo specific processors. I am not a Mongo user myself, but have you looked to see if any of those would meet the needs of your dataflow here?

-

Thank you,

Matt

-

If you found this answer addressed your question, please take a moment to login in and click the "ACCEPT" link.

Highlighted

Re: NIFI -- How to import python libs for ExecuteScript

Super Guru

If the "mongo" library contains native Python (CPython) code or dependencies, you can't use them in ExecuteScript (which uses Jython not Python). See Matt C's answer for a workaround to use actual Python.

Highlighted

Re: NIFI -- How to import python libs for ExecuteScript

Explorer

Hi Matt, thanks for your answers, do you think Mongo is native in Groovy or JavaScript?

Thanks

Highlighted

Re: NIFI -- How to import python libs for ExecuteScript

Super Guru

There is a mongo-java-driver you can use in either Groovy or Javascript (or any of the scripted languages in ExecuteScript), check my blog on how to use modules.

Don't have an account?
Coming from Hortonworks? Activate your account here