Skip to main content
Solved

How do I set a Group By in a PythonCaller?

  • September 19, 2018
  • 1 reply
  • 228 views

fmelizard
Safer
Forum|alt.badge.img+18

I have a fancy Python script running in my PythonCaller, but I want to use a "Group By" logic to process my features. I'd rather not have to manually split my features and plop down a PythonCaller for each separate stream. Is there an easy way to do this within the Python script? Or any way??

Best answer by nathanatsafe

There seem to be two ways to use "Group By" logic with a PythonCaller.

 

1) Wrap your PythonCaller in a custom transformer and harness the power of the "Parallel Process By" advanced parameter. See this post for more details.

2) Use the PythonCaller class template and build a dictionary in the input method. The dictionary keys will become unique groups, while the values for each key will contain a list of features belonging to the group. With this method, most of your processing will have to take place in the close method, after looping through each key in the dictionary and/or each list of features mapped to each key.

 

Take a look at the sample script for more details!

 

 

Also don't forget to head over and vote on this idea, or post your own PythonCaller wishlist!

View original
Did this help you find an answer to your question?

1 reply

nathanatsafe
Safer
Forum|alt.badge.img+7
  • Safer
  • Best Answer
  • September 19, 2018

There seem to be two ways to use "Group By" logic with a PythonCaller.

 

1) Wrap your PythonCaller in a custom transformer and harness the power of the "Parallel Process By" advanced parameter. See this post for more details.

2) Use the PythonCaller class template and build a dictionary in the input method. The dictionary keys will become unique groups, while the values for each key will contain a list of features belonging to the group. With this method, most of your processing will have to take place in the close method, after looping through each key in the dictionary and/or each list of features mapped to each key.

 

Take a look at the sample script for more details!

 

 

Also don't forget to head over and vote on this idea, or post your own PythonCaller wishlist!


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