Skip to main content
Gathering Interest

Add dynamic input ports to the PythonCaller

Related products:Transformers
  • Apr 24, 2020 12:00 AM UTC
  • 10 replies
  • 224 views

fmelizard
Safer
Forum|alt.badge.img+22

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

10 replies

david_r
Celebrity
  • Apr 28, 2020 7:47 AM UTC

david_r
Celebrity
  • May 4, 2020 6:46 AM UTC

ebygomm
Evangelist
Forum|alt.badge.img+54
  • Evangelist
  • May 4, 2020 7:32 AM UTC

Interested in how this would actually work within the pythoncaller


david_r
Celebrity
  • May 4, 2020 7:44 AM UTC
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
Evangelist
Forum|alt.badge.img+54
  • Evangelist
  • May 4, 2020 7:58 AM UTC
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
Celebrity
  • May 4, 2020 8:19 AM UTC

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+41
  • Contributor
  • May 4, 2020 8:35 PM UTC

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
Celebrity
  • May 5, 2020 6:43 AM UTC

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?


LizAtSafe
Safer
Forum|alt.badge.img+27
  • Safer
  • Dec 19, 2025 11:12 PM UTC
Gathering Interest→Open

LizAtSafe
Safer
Forum|alt.badge.img+27
  • Safer
  • Mar 31, 2026 11:19 PM UTC
Open→Gathering Interest