Skip to main content
Released

Group-By parameter on the PythonCaller

Related products:FME Form
  • January 17, 2017
  • 7 replies
  • 136 views

jdh
Contributor
Forum|alt.badge.img+40

It would be nice if the PythonCaller had a parameter for a group-by so I don't have to code the logic each time I need it.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

7 replies

fmelizard
Safer
Forum|alt.badge.img+22
  • Safer
  • January 18, 2017

 

GREAT idea.

jdh
Contributor
Forum|alt.badge.img+40
  • Author
  • Contributor
  • January 18, 2017
The code gets very interesting when I'm dealing with a custom transformer where the group-by is a user parameter, since the python api does not gracefully handle them. [see http://knowledge.safe.com/idea/21410/python-caller-user-parameters-automatically-prefix.html]

 

 


Forum|alt.badge.img+7

I really like this idea if also the option 'Input is ordered by group' is present so that the PythonCaller doesn't become a blocker transformer when the input is ordered.


fmelizard
Safer
Forum|alt.badge.img+22
  • Safer
  • July 17, 2017

As a workaround for this, if anyone is interested, you can stick you're PythonCaller inside a custom transformer. Custom Transformers have the option to enable groups and parallel processing. When inside a custom transformer, take a look at the Advanced Transformer Parameters in the Navigator Pane.


jdh
Contributor
Forum|alt.badge.img+40
  • Author
  • Contributor
  • July 20, 2017
The issue with a custom transformer wrapper is that working with parameters becomes difficult, as the parameter name is prefixed by the transformer name, and that transformer name is variable.

 

 

The workaround to that is to use a parameterFetcher and then in python access the values as attributes rather than parameters. However that creates unnecessary attributes that then require cleanup, and risks overwriting actual attribute values if there is a name clash.

 


ebygomm
Evangelist
Forum|alt.badge.img+49
  • Evangelist
  • June 8, 2020

How do you envisage this working in practice? Running the entire code for each set of features?


jdh
Contributor
Forum|alt.badge.img+40
  • Author
  • Contributor
  • June 8, 2020

Yes, I would expect the entire code, including input and close methods to be run for each group of features.