Removing Attributes
Removing attributes is perhaps seen as a less important task in FME. That's because - for a manual attribute schema - only attributes defined in the writer are written to the output; extra attributes that are not required are just ignored.
However, removing attributes does carry useful benefits:
- Removing attributes that aren’t required tidies up a workspace and makes it easier to understand
- A workspace is a complex network of objects and schemas. Removing attributes simplifies this network and makes the Workbench interface more responsive
- All data processing incurs costs of time and memory. Removing attributes means less data is being processed and so the FME engine performs faster
TIP |
A reader feature type has parameters to hide attributes from the schema. This helps tidy a workspace, but does not help improve the translation performance. However, some formats (mostly databases) also have a setting for "Attributes to Read" and using this will help performance. |
Transformers that can remove attributes are:
- AttributeKeeper
- AttributeManager
- AttributeRemover
- BulkAttributeRemover
Removing Attributes
The AttributeManager and AttributeRemover have the same technique; select an attribute to be removed:
Attributes can be removed in the AttributeManager by selecting it and clicking the - button. Alternatively, you can change the action field from Do Nothing to Remove.
Notice in the above that three attributes have been removed. The output attribute (when selected) shows the name struck out to signify that it is no longer present.
Keeping Attributes
The AttributeKeeper transformer carries out the same function but approaches it from the opposite direction. It lets the user specify which attributes are not to be removed; in other words, this transformer lets the user specify which ones to keep.
So, the AttributeManager should be used where one or two attributes are to be removed, but the majority of them kept. The AttributeKeeper should be used when the majority of attributes are to be removed, and only one or two of them kept.
Bulk Attribute Removal
The BulkAttributeRemover - like the BulkAttributeRenamer - lets the user carry out a process on multiple attributes. In this case, instead of being able to select all attributes, the user enters a string-matching expression to define which attributes to remove:
Here the user is removing all attribute whose name ends in the word "Count."