Skip to main content
Gathering Interest

Add dynamic input ports to the PythonCaller

Related products:Transformers

fmelizard
Contributor

Introduce the ability to add Dynamic input ports to the PythonCaller.

8 replies

david_r
Evangelist
  • April 28, 2020

david_r
Evangelist
  • May 4, 2020

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • May 4, 2020

Interested in how this would actually work within the pythoncaller


david_r
Evangelist
  • May 4, 2020
Same. I'm imagining a second, optional parameter to the "input()" method that would give the name of the input port of the feature, but who knows.

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • May 4, 2020
I've previously had a process which was doing some list comparisons (one 'master' list, against lists on many features), for performance reasons I ended up having one of the lists written to a csv which was then read and turned back into a list in def __init__ and then the list comparison done for the list on each feature. Interested in whether multiple ports could handle this instead.

david_r
Evangelist
  • May 4, 2020

Yes, I've done similar stuff several times. I often end up using two PythonCallers and e.g. a global dict to share data between them. Not a solution I particularly like, but it works.


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • May 4, 2020

Interesting, I often just create dictionaries in the init, and then the input tests each feature for the value of an attribute (created in the appropriate stream before the pythoncaller) and appends it to the appropriate dictionary.

It's inefficient when there is 1 input_A and several thousand input_Bs.


david_r
Evangelist
  • May 5, 2020

Sure, I've done that as well, especially if the content is static. But if the content is e.g. from a database table then I find it's easier (and cleaner, imho) to let FME read it, rather than using Python modules to read the contents. Sending reader content into the __init__ is not something I know how to do using a single PythonCaller.

It's inefficient when there is 1 input_A and several thousand input_Bs.

Why would that be inefficient? With connection runtime ordering it would be fairly simple to assure that input_A always comes before the input_Bs, which is something the code could reflect. Or am I missing something?


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings