Deriving Destination Schema from Schema Feature

You can use a dynamic writer to define your destination schema. In dynamic mode, the writer checks the first feature of each incoming feature type for the presence of a specific type of list attribute that provides schema information. If this list is found on the first feature, it can be used to generate the output schema for the writer.

To generate this list, use any of the following:

  • The <Schema> output port of the FeatureReader or SchemaScanner transformers.
  • AttributePivoter transformer
  • Schema (Any Format) reader

Alternatively, you can build your own schema feature. For requirements, see Schema Feature Requirements, below.

To use the list to define destination schema, set the Schema Sources parameter of the dynamic writer's feature type to "Schema from Schema feature".

For a detailed example, including sample workspaces, see Dynamic Workflows: Destination Schema is Derived from a Schema Feature in the FME Community.

Schema Feature Requirements

A schema feature is comprised of a list, named attribute, and the following attributes:

Attribute Name

Description

Example

Required?

name Name of the attribute for the feature type. attribute{0}.name Yes
fme_data_type FME data type of the attribute. attribute{0}.fme_data_type Yes
native_data_type Data type of the attribute specific to the source format. attribute{0}.native_data_type Include only if you want to specify a format-specific data type.

A second list, named fme_geometry, is required for writer formats that require separate feature types for each unique geometry. The list element value is the fme_type attribute value for the geometry. For example: fme_geometry{0} may have a value of "fme_point" and fme_geometry{1} may have a value of "fme_line".

To instruct the dynamic writer to apply the native_data_type to the schema feature, instead of the fme_data_type, specify attribute fme_format_short_name and set the value to the Format Type Identifier ("short name") of the format. For example, fme_format_short_name = “GEODATABASE_FILE”.

An optional attribute and value, fme_schema_handling = ‘schema_only’, may be output to instruct the dynamic writer that the schema feature contains no data, so that the writer does not insert it as a new record. If not set or missing, the writer uses the feature to create the table and also inserts it as a record (that is, it assumes the feature has both schema and data).