Talend Open Studio Cookbook
上QQ阅读APP看书,第一时间看更新

Creating a generic schema from the existing metadata

Any schema can be easily converted into a generic schema to enable it to be re-used. The following recipe shows two methods of creating generic schemas; the first from a pre-existing schema in the metadata repository and the second from a built-in schema.

How to do it…

From repository schema

  1. Open repository schema fd_cook_0020_customerDelimited that can be found in the delimited schemas section under Chapter2, ensuring that you click the metadata, rather than the parent schema.
    How to do it…
  2. Right-click metadata, and then select copy to Generic schema. This creates a schema fd_cook_0020_customerDelimited.
  3. Move the new schema to the chapter 2 folder and double click it to edit it.
  4. Change the name to sc_cook_0020_genericCustomer1.

From a built-in schema

  1. Open the Talend Job jo_cook_ch02_0020_builtInSchema and open the tFileOutput Delimited component.
  2. Click the highlighted button, shown in the following screenshot:
    How to do it…
  3. This will open a windows file save dialogue. Save the file as sc_cook_0020_genericCustomer.xml.
  4. Now create a new generic schema from the saved XML file by right-clicking Generic schemas, and selecting the option Create generic schema from xml:
    How to do it…
  5. Select the XML file that was just saved, and click finish to create the new Generic schema sc_cook_0020_genericCustomer2.

How it works…

Under the covers, Talend stores schemas in XML format files, regardless of the type of schema. This means that schemas can be easily converted between types, in this case between built-in and repository.