Read Schemas from Database with Schema (Any Format) Reader

Schema (Any Format) リーダーでデータベースからスキーマを読む

I mentioned a quick way to create a look-up table for the Dynamic Schema in this thread.
Community Answers > Can you use SchemaMapper or BulkAttributeRenamer with a dynamic schema writer?

Related articles 関連記事:
FMEpedia > Dynamic Workflow Tutorial: Destination Schema is Derived from a Lookup Table
This Blog > Common Table for SchemaMapper and Dynamic Schema

The Schema (Any Format) reader followed by a ListExploder can be used to create a table that contains feature type names, attribute names and their data type names of source feature types. It will cut down your time and effort for creating a look-up table for the Dynamic Schema.
It's a wisdom of a lazy person who doesn't want to move his/her hands :)
Schema (Any Format) リーダーとListExploderは、ソースフィーチャータイプのフィーチャータイプ名、属性名、およびそれらのデータ型名を含むテーブルを作成するのに使えます。これは、ダイナミックスキーマ用のルックアップテーブルを作成するための時間と労力を削減するでしょう。
手を動かしたくない怠け者の智恵です (^^)

When adding the Schema reader, you need to specify the source dataset to its Dataset field.

If the physical form of the source dataset was a file, you can select the file with the general Select File dialog box. And if it was a folder (e.g. ESRI File Geodatabase), you can enter the folder path into the Dataset field directly.
ソースデータセットの物理的な形態がファイルである場合は、通常のファイル選択ダイアログボックスによって選択することができます。 また、フォルダ(例えばESRI File Geodatabase)である場合は、Datasetフィールドにフォルダパスを直接入力することができます。

So then, how can you set a database as its source dataset?

The Schema reader doesn't have parameters for database connection, such as host name, port number, user name, password. Even though you specified the database name to the Dataset, naturally you cannot configure the connection to the database.

To read schemas from a database, add the database format specific reader to the workspace and set its parameters (host name, port number etc.) properly.
And then, for the Schema reader,
- set the "Source Dataset" parameter to the database name,
- set the "Input Format" parameter to the format name explicitly.
After this, the Schema reader will be able to connect to the database, and to read schemas of the tables, since it can refer to configuration of another reader in the same workspace.
- "Source Dataset"パラメーターにデータベース名を設定し,
- "Input Format"パラメーターにフォーマット名を明示的に設定します。

This is an example of the configuration to read schemas from a PostgreSQL database.

You can select feature types (tables) with the "Feature Types to Read" parameter of the POSTGRES reater. If you don't need to read data from the database, you can set the "Max Features to Read" parameter to 1 (0 seems to be invalid unfortunately).
フィーチャータイプ(テーブル)は、POSTGREASリーダーの"Feature Types to Read"パラメーターで選択できます。データベースからデータを読む必要がなければ、"Max Features to Read"パラメーターを1に設定できます(残念ながら0は無効なようです)。

I added the POSTGRES reader as a usual reader in the above example, but you can also add it as a Workspace Resource (Menu: Readers > Add Reader as Resource).
This may be better if you don't need to read the actual data.
上の例ではPOSTGRESリーダーは通常のリーダーとして追加しましたが、ワークスペースリソースとして追加することもできます(Menu: Readers > Add Reader as Resource)。

In addition, the "referring to another reader configuration" can also be applied to read schemas from a web dataset like the Google Maps Engine.
加えて、この「他のリーダーの設定を参照する」機能は、Google Maps Engineなどのウェブデータセットからスキーマを読み込むのにも応用できます。

FME 2014 SP4 build 14433

Wow, FME 2014 SP5 build 14440 has been released!
おぉ、FME 2014 SP5 build 14440 がリリースされている!
The Safe Software Blog > FME Service Packs: The Dawning of the Age of .0

Scripting is also possible but I would not recommend to use it in a practical workspace.
Just a self-training concerning Python FME Objects API.
Python FME Objects API に関するトレーニングです。
# Script Example for PythonCreator, 2014-12-14 Updated
import fmeobjects
class PostgresSchemaReader(object):
    def close(self):
        directives = [
            'IDLIST', 'table1,table2,table3',
        parameters = [
            '_HOST', 'localhost',
            '_PORT', '5432',
            '_USER_NAME', 'username',
            '_PASSWORD', 'foobar',
        reader = fmeobjects.FMEUniversalReader('POSTGRES', False, directives)
        reader.open('test', parameters)
        while True:
            schema = reader.readSchema()
            if schema == None:
            featureTypeName = schema.getFeatureType()
            schema.setAttribute('fme_feature_type_name', featureTypeName)
            for i, name in enumerate(schema.getSequencedAttributeNames()):
                fmeDataType = schema.getAttribute(name)
                nativeDataType = schema.getAttribute('*%s' % name)
                schema.setAttribute('attribute{%d}.name' % i, name)
                schema.setAttribute('attribute{%d}.fme_data_type' % i, fmeDataType)
                schema.setAttribute('attribute{%d}.native_data_type' % i, nativeDataType)


  1. Thanks to Casci cover

    We are actually exploring how we might make it easier to read schemas in FME 2016. We are exploring either an addition to the FeatureReader for this purpose, or implementing complete parameter support inside of the Schema Reader. No matter what, I'm glad to know it would be worthwhile for you. It does enable very powerful workflows.

    1. Hi Dale, thanks for the comment.

      Good to hear you are exploring the way to make it easier.
      In my personal opinion, it might be better that the Schema reader would have complete parameters.
      e.g. add a button to the parameters dialog; it will be enabled only if the user selects Input Format explicitly, and the format specific parameters dialog will be open when the user clicks the button.
      Anyway, I look forward to seeing the enhanced Schema reader in FME 2016.

      oops, FME 2015 has not been released yet, talking about 2016 is too early.
      FME 2015 coming soon. I'm really looking forward the release.

      Wish you and your family greet a happy new year!