Support Questions

Find answers, ask questions, and share your expertise

NIFI -- How to import python libs for ExecuteScript


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


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,



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

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.


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


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.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.