FME Transformers: 2024.1

Categories
Database
Workflows
Related Transformers
FeatureReader
SchemaMapper

SchemaScanner

Produces a schema feature representing the feature type definition for each group of input data features.

Jump to Configuration

Typical Uses

  • Generating a schema feature for dynamic writers

  • Generating schema features for comparison for schema validation and schema drift

  • Generating schemas after merging or manipulating datasets

How does it work?

The SchemaScanner receives features and determines their schema by scanning for attribute names and data types, based on the features' structure and attribute values.

It will scan either all features or a specified number of them, and can exclude certain attributes based on names, such as format-specific or internal FME attributes.

The resulting schema is output as a new schema feature, which has a specific form of list attribute and is output via the <Schema> port. It also receives a special attribute and value: fme_schema_handling = ‘schema_only’, which tells a dynamic writer to use that feature as a schema and then remove it from the output.

The original input features are passed out via the Output port.

The output order of the schema features relative to the data (input features) can be controlled using the Output Schema Before Data Features. For use with dynamic writers, the schema features should be output first.

Attribute Generation

Schemas can be generated with either standard data types or explicitly defined ones, according to the Numeric and String Data Types parameters:

  • Standard Types produces types such as fme_real64 , fme_int8 and fme_buffer.

  • Explicit Width and Precision produces types such as:

    • fme_decimal(a,b) where a is the number of digits before a decimal, and b the number of digits after (precision).

    • fme_varchar(a) where a is the maximum number of characters in a string.

When using Explicit Width and Precision, consider scanning all features (Number of Features to Scan) to ensure all existing attribute value lengths are considered.

Working with Dates

Dates and times may be optionally scanned for.

If strings match the FME datetime format of %Y%m%d%H%M%S they may be scanned for with Detect FME Dates .

To scan for strings that match another date or time format, use Convert Input Date Format to FME Date . Note that this option is only available if Output Schema Before Data Features is set to Yes.

See Standard FME Date/Time Format for formatting details.

Excluding Attributes

SchemaScanner processes all attributes on incoming features, including fme and format attributes. It is possible to ignore attributes using the Ignore Attributes Containing parameter.

Enter a regular expression, and matching attributes will be ignored.

For example, if the source data is CSV, you could use the regular expression ^fme_|^multi_|^csv_ to ignore any attributes starting with fme_, multi_, or csv_.

Schema Features

Schema features can be used to store or pass along schema structures - to dynamic writers, for example. The schema is stored in a list attribute named attribute, as shown here.

Each attribute has a name and an fme_data_type - note the attribute LAT has a corresponding data type of fme_real64.

Data types are FME internal data types.

Usage Notes

  • Schema features may also be generated manually, or by using the FeatureReader's schema options. Two readers also generate schemas - the Schema (Any Format) reader and the Schema (From Table) reader.
  • When using the SchemaScanner with a dynamic writer, the Output Schema Before Data Features parameter should be set to Yes, so that the schema arrives at the writer prior to the data features.

Configuration

Input Ports

Output Ports

Parameters

Editing Transformer Parameters

Transformer parameters can be set by directly entering values, using expressions, or referencing other elements in the workspace such as attribute values or user parameters. Various editors and context menus are available to assist. To see what is available, click beside the applicable parameter.

For more information, see Transformer Parameter Menu Options.

Reference

Processing Behavior

Group-Based

Feature Holding

If Output Schema Features Before Data is Yes then the transformer will block all the incoming data features. This is usually required if you are using the schema feature with a dynamic writer.

Target Number of Features to Scan will also block the data features - up to the number of features selected (or all features, if left blank).

Dependencies None
Aliases  
History  

FME Community

The FME Community is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.

Search for all results about the SchemaScanner on the FME Community.

 

Examples may contain information licensed under the Open Government Licence – Vancouver, Open Government Licence - British Columbia, and/or Open Government Licence – Canada.