Writer Mode

Many writers that do not yet support the Feature Operation specification share a Writer Mode specification, which determines how features will be written into the destination table.

Note  See specific format documentation for Feature Operation or Writer Mode details.

The writer mode can be specified at three unique levels:

  • Writer
  • Table
  • Feature

Writer Level

At the writer level, possible values are:

  • Insert – Implies insert only; can be overridden only by table-level modes, not feature-level modes.
  • Update – Update table, but can be overridden by table- and feature-level modes.
  • Delete – Delete from table, but can be overridden by table- and feature-level modes.

Table Level

At the table level, possible values are:

  • Inherit From Writer – Inherits the writer-level writer mode

  • Insert

  • Update

  • Delete

Feature Level

At the feature level, the writer mode can be set by an attribute named fme_db_operation. Possible values for this attribute are:

  • Insert

  • Update

  • Upsert

  • Delete

The value of fme_db_operation will be processed according to the steps below.

Note   The processing steps listed below depend on a format's available Feature Operation options.
  • If the value is null, empty, or missing, it will be treated as an Insert.
  • The value will next be matched to Insert, Update, Upsert, Put, and Delete, case-insensitively.
  • If there is no match, the feature will be rejected.
  • If there is a match, the matched feature operation will be performed on the feature.

Note about earlier FME versions: To use fme_db_operation, you must set Feature Operation to this option. In previous versions of FME, you could set fme_db_operation when the destination feature type was set to Insert, Update, Upsert, or Delete. Doing this now will cause feature rejection.

Notes

  • Updates performed on rows that DO NOT EXIST are NOT turned into inserts. The user is warned and the feature is rejected.

  • Inserts performed on rows that EXIST are NOT turned into updates. FME will still attempt to perform the insert: if it is not prevented by a unique index, it will insert a duplicate row; if it is prevented by a unique index, the feature will be rejected, or translation will fail, depending on the writer.

  • Updates are not limited to one row per feature. It is possible to update the entire table with one feature.

  • Geometry can also be updated using update mode. The geometry on the update feature will replace the geometry in all of the matched rows, with one exception. If a feature has no geometry, the destination geometry column will either be replaced with a null value, or not be updated, depending on the writer.

  • Although a single query feature may cause more than one feature to be edited, the update/delete feature is restricted to changing only those features of the same feature type. This means that we cannot have an update feature with a feature type of "provinces" updating features of feature type "cities". In general, a feature type in a database format corresponds to a table; however, it may also correspond to a view.