Skip to main content

I have several (SQLCreator) sources and other transformers all feeding into a PythonCaller. I'm using the PythonCaller to pull certain attributes from each feature and create new features.

Is there a good way to determine which features come from which sources/transformers inside the Python script?

Currently I'm testing each feature for specific attributes, but this will not work for situations where features from multiple sources have the same attributes.

I create a specific attribute, that explicitly contains what "stream" the data is coming from.

 

There is an attributeCreator on each stream just prior to the PythonCaller, with a common attribute (I use _!type) with a different value for each stream. I retrieve that value in the PythonCaller and test for the various values.

 

Likewise if I want to split the output, I attach a temporary attribute to the outgoing feature and use a tester/testfilter after the PythonCaller.

Hello @carlreedw

For these transformers:

0684Q00000ArJv0QAF.png

The following python code will display:

Creator_CREATED

Creator_2_CREATED

 

import fme
import fmeobjects

class FeatureProcessor(object):
    def __init__(self):
        pass
    def input(self,feature):
        print str(feature.getFeatureType())
        self.pyoutput(feature)
    def close(self):
        pass

Regards,

Larry


Reply