Advanced Dynamic Attribute Schemas

In general, the schema for a dynamic translation comes from either the source dataset itself, or from a different dataset (such as the database table the data is being written to).

However, there are two other scenarios for providing the output schema: it can come from a text file (or spreadsheet) in which the definition is stored; or it can be actually defined dynamically as a list of attributes in a workspace.

Table-Based Schemas

In this scenario, the output schema is stored as some form of table in a text file or spreadsheet; for example:

Here the author has listed a series of feature types, attributes, and geometry types that define the output schema. In FME they would use this schema by adding a Resource Reader. The format of the Resource Reader would be Schema (From Table):

In the parameters dialog for this Reader, there are parameters that specify which fields in the table represent which parts of the schema:

Geometry type is optional, but used in this example.

Attribute sequence is another optional parameter. It defines a field in the table that records the order that attributes should appear in.

Then, of course, this Reader must be used as the source for the output schema:

As always, the incoming attributes must be mapped to the outgoing schema. The best way here is the SchemaMapper transformer, since it too can use a lookup table to create its mappings.


Sister Intuitive says…
The great advantage of this method is that you don’t need to edit the workspace, or edit a dataset, to make schema changes. Once you change the output schema in the table, then that is automatically applied in the FME translation. That’s heavenly!

Constructed Attribute Schemas

This scenario is a way to construct an attribute schema using lists in FME. The schema is defined by using attributes in the list, for example:

The Writer is told to use this schema in preference to any others by selecting it as the Source Schema:


FME Data Types

Both of the two preceding tools allow the user to define attribute type in an output schema. There are a set of valid datatypes in FME, which are as follows:

General Field TypeSpecific Field Types
Character Fieldsfme_varchar(width), fme_char(width), fme_char
Integer Fieldsfme_uint8, fme_int16, fme_uint16, fme_int32, fme_uint32, fme_int64,fme_uint64
Numeric Fieldsfme_decimal(width,decimal), fme_real32, fme_real64
Date-Time Fieldsfme_datetime, fme_time, fme_date
Other Fieldsfme_buffer, fme_boolean

Miss Vector says…
The ability to construct a dynamic schema from attributes in a workspace has lots of possibilities. In fact, one of these FME transformers automatically creates dynamic schema attributes specifically so you can create a new schema. Which is it?

1. SchemaMapper
2. AttributePivoter
3. PythonCaller
4. Clipper

results matching ""

    No results matching ""