How to get a list of attributes in FME when there are no records in the table? I try use a PythonCaller but when there are no records, FME passes over this table. In PythonCaller I write:

import fmeobjects
def FeatureProcessor(feature):
    print feature.getAllAttributeNames()

Is it possible to get attributes when there is no record?

  • What sort of table are you querying? Database, shape, etc ...
    – MickyT
    Sep 10, 2014 at 18:42
  • Database. I use readers for oracl.
    – user7172
    Sep 10, 2014 at 18:52

3 Answers 3


This may possibly do what you want.

After your oracle reader, put in a NullAttributeReplacer factory. Connect the reader to that factory. Also put in a Creator factory and connect that to the NullAttributeReplacer factory. Replace all NULLs with 0.

So that any features that may come from the table do not get NULLs replaced, disable the connection between it and the NullAttributeReplacer. It still needs to be in place so that the NULL replacer knows what attributes to use.

This guarantees that at least a single feature goes through with all the attributes and should be discoverable by pythons getAllAttributeNames. That feature can then be thrown away.

enter image description here enter image description here


For FME2014 using the NullAttributeMapper You will need to ensure that you are using Selected Attributes and the ones you want to appear are selected.

For the first condition make sure that Missing is selected.

The Map To: value can be anything other than Missing. enter image description here

  • 'The NullAttributeMapper transformer has been added to FME 2014. It can be used to convert between <null> and non-null; the functionality of the NullAttributeReplacer transformer in FME 2013 has been integrated to it.'( fme-memorandum-takashi.blogspot.com/2013/12/…)
    – user7172
    Sep 11, 2014 at 7:21
  • I haven't upgraded to 2014 yet, but the concept should stay the same.
    – MickyT
    Sep 11, 2014 at 7:30
  • I my FME logger print only atributes from Creator. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Feature Type: Logger_LOGGED' Attribute(32 bit unsigned integer): _creation_instance' has value 0' Attribute(string) : fme_feature_type' has value Creator' Attribute(string) : fme_geometry' has value fme_undefined' Attribute(string) : fme_type' has value fme_no_geom' Coordinate System: ' Geometry Type: IFMENull ============================
    – user7172
    Sep 11, 2014 at 7:45
  • Does your reader show any attributes when you expand it? Is it connected to the NullReplacer/NullMapper. Have you selected all the attributes to be replaced?
    – MickyT
    Sep 11, 2014 at 8:16
  • Yes,Yes,Yes (:))
    – user7172
    Sep 11, 2014 at 8:21

An alternative approach is to use the fmeObjects.FMEUniversalReader() as follows:

First point it to the workspace by invoking the .open() and including the dataset name. Next, use readSchema() which returns a feature-looking result for each workspace element.

(Its odd, but you get a feature that represents the schema of the featureclass.)

Finally, loop through the readSchema() and parse out the attribute names for each new workspace element. You explained that you want a 'list' so outputting them into XML or other context seems appropriate.

Sometimes, the simpler answers are most effective...please give FMEUniversalReader.readSchema() a try.


FME 2014 NullAttributeMapper

For the specified attributes, check the value of the attribute in the input feature and if it is one of the specified values, take the action specified by the Map To parameter. Values that can be matched are:

Empty – The attribute exists and has an empty string as its value.
Null – The attribute exists and has a value of null.
Missing (Selected Attributes Only) – The attribute does not exist. This choice does not apply if the Map parameter is set to All Attributes. We can only know that an attribute is missing if it has been explicitly specified through the Selected Attributes parameter.


Example: http://fme-memorandum-takashi.blogspot.com/2014/01/nullattributemapper-use-case-assign.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.