One of the ways to update features in a database is by using the Feature Based Attribute fme_db_operation
. The attached workbench (fme_db_operation.fmwt) illustrates the use of this to update or delete features from a database.
The steps involved are
- test the incoming features for a value which will decide between updating, deleting, inserting or ignoring - e.g. PERCENT > 10
- add the attribute fme_db_operation to the features and assign it a value - either UPDATE/DELETE/INSERT
- change a value if you want to update a field - e.g. PERCENT = 25
- set the UPDATE KEY COLUMN to some attribute which will match the input features to the database features - in this case it is the attribute "ID". For writers that do not have the Update Key Field use the fme_where attribute
- change the WRITER MODE on the destination dataset to UPDATE
The feature based attribute fme_db_operation
is available on most of the database readers and writers. See http://docs.safe.com/fme/pdf/FMEReadersWriters.pdf
The second sample workspace focuses on the use of writer mode on the feature itself - see DataBaseWriterMode.fmwt.