If the Store Repository Type of a data store is Kafka, the Layout panel contains a Build Schema and Transformations button. Click this button to open the Build Schema and Transformations dialog.
You can build a schema manually, or by using sample content. Click Add, then select an option from the drop down menu:
- Field - Select the Field option to start creating the schema manually, or to add a field to or edit an existing schema. For details, see Building schema manually.
- From Sample JSON - This option is available if the Layout Type is JSON. Select this option if you have an example of the JSON that the Kafka store holds. For details, see Building schema by using sample content.
- From Avro File - This option is available when the Layout Type is Avro. Select this option to use a sample Avro file to generate the schema. For details, see Building schema by using sample content.
- From XML File - This option is available when the Layout Type is XML. Select this option to use a sample XML file to generate the schema. The Row Tag also needs to be specified. For details, see Building schema by using sample content.
If the This channel will be used to write to Kafka data store property is selected, the fields tab includes only the "key" and "value" fields. Both fields are of type string.
If the This channel will be used to write to Kafka data store property is not selected, when you save any changes in the transformation dialog, the output structure is used to create the data store field definitions. The following fields are automatically added:
- kafka_original_value (string)
- kafka_message_timestamp (datetime)
- kafka_parse_failed (string)
- With the Schema and Transformation Builder open, Click Add.
- Select the option from the drop down list.
- Click in the text area.
-
Enter the sample content that represents the content you want to parse. For example, you might have the following sample JSON:
{"region":"name", "city": "name"}
. - Click Build Schema. The transformation is automatically generated using the default parsing options.
- Click OK to close the Edit Transformations Window
- Click Accept Changes.
If you use the generator to build your schema, the first field in the schema will always be a Struct with no Source Name given.